public object visitAssignExpr(Expr.Assign expr) { Object value = evaluate(expr.value); environment.Assign(expr.name, value); return(value); }
internal void Assign(Token name, Object value) { if (Values.ContainsKey(name.Lexeme)) { Values[name.Lexeme] = value; return; } if (enclosing != null) { enclosing.Assign(name, value); return; } throw new RuntimeError(name, "Undefined variable '" + name.Lexeme + "'"); }