evaluate method

  1. @override
void evaluate(
  1. SymbolTable table
)
override

Evaluates all child nodes in order within a new scope.

Creates a child symbol table to represent the block's scope, then evaluates each child node sequentially. This ensures that variable declarations within the block don't affect the parent scope.

Parameters:

  • table: The parent symbol table

The method doesn't return a value as blocks are statements, not expressions.

Implementation

@override
void evaluate(SymbolTable table) {
  final newTable = table.createChild();
  for (var child in children) {
    child.evaluate(newTable);
  }
}