Skip to content

Stray DEBUG print to stdout in ForStatement.execute #1

Description

@leehack

lib/src/ast/nodes.dart:182 in dinja 1.0.0 writes to stdout:

print('DEBUG: For loop on Function: ${iterableVal.name}');

It sits inside ForStatement.execute, immediately before throw Exception('Expected iterable in for loop: got ...'). Every other DEBUG print in the package is commented out; this one was missed.

A library should not write to stdout — the line surfaces in the output of any application embedding dinja.

When it fires: a {% for %} iterating a value that resolves to a JinjaFunction — a bare builtin/global (range, dict, namespace, strftime_now, ...) or a method referenced without parentheses, e.g. {% for k, v in m.items %}.

Suggested fix: fold the function name into the exception thrown two lines later, so the diagnostic survives without touching stdout.

Found while auditing llamadart, which depends on dinja for chat-template capability detection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions