visitVariableDeclarationStatement method

  1. @override
void visitVariableDeclarationStatement(
  1. VariableDeclarationStatement node
)
override

Implementation

@override
void visitVariableDeclarationStatement(VariableDeclarationStatement node) {
  // Match the interpreter's executeBlock order: evaluate the initializer
  // BEFORE the name is in scope (so `var x = x` reads the outer `x`), then
  // declare the slot. Visiting only the initializer here (not the name node)
  // keeps the declaration identifier out of the use-resolution path.
  for (final v in node.variables.variables) {
    v.initializer?.accept(this);
    _declareLocal(v.name.lexeme, v);
  }
}