visitTopLevelVariableDeclaration method
Visit a STopLevelVariableDeclaration.
Implementation
@override
void visitTopLevelVariableDeclaration(STopLevelVariableDeclaration node) {
// Does nothing for global variables in this pass (handled by InterpreterVisitor)
for (final variable in node.variables?.variables ?? []) {
final varName = variable.name?.name ?? '';
if (varName == '_') {
// Ignore wildcard variables
continue;
}
// For now, just define the variable name with null.
// The actual initialization will happen in InterpreterVisitor.
if (!environment.isDefinedLocally(varName)) {
environment.define(varName, null);
Logger.debug(
"[DeclarationVisitor] Defined top-level variable placeholder '$varName' in env: ${environment.hashCode}");
}
}
}