declare method

void declare(
  1. Token name
)

Implementation

void declare(Token name) {
  if (scopes.isEmpty) return;
  Map<String, bool> scope = scopes.peek();
  if (scope.containsKey(name.lexeme)) {
    error1(name, 'Variable with this name already declared in this scope.');
  }
  scope[name.lexeme] = false;
}