lookUpVariable method

Object? lookUpVariable(
  1. Token name,
  2. Expr expr
)

Implementation

Object? lookUpVariable(Token name, Expr.Expr expr) {
  if (locals.containsKey(expr)) {
    int distance = locals[expr]!;
    return environment.getAt(distance, name.lexeme);
  } else {
    return globals.get(name);
  }
}