Пример #1
0
        public object visitAssignExpr(Expr.Assign expr)
        {
            var value = evaluate(expr.value);

            if (locals.ContainsKey(expr))
            {
                environment.assignAt(locals[expr], expr.name, value);
            }
            else
            {
                globals.assign(expr.name, value);
            }

            return(value);
        }
Пример #2
0
 public object visitAssignExpr(Expr.Assign expr)
 {
     resolve(expr.value);
     resolveLocal(expr, expr.name);
     return(null);
 }