Example #1
0
        public object visitAssignExpr(Expr.AssignExpr assignExpr)
        {
            object value = evaluate(assignExpr.value);

            if (locals.TryGetValue(assignExpr, out int distance))
            {
                environment.assignAt(distance, assignExpr.name, value);
            }
            else
            {
                globals.assign(assignExpr.name, value);
            }
            return(value);
        }
Example #2
0
 public object visitAssignExpr(Expr.AssignExpr assignExpr)
 {
     resolve(assignExpr.value);
     resolveLocal(assignExpr, assignExpr.name);
     return(null);
 }
Example #3
0
 public string VisitAssignExpr(Expr.AssignExpr expr)
 {
     return(Parenthesize2("=", expr.Name.Lexeme, expr.Value));
 }
Example #4
0
 public string visitAssignExpr(Expr.AssignExpr assignExpr)
 {
     return(parenthesize("= " + assignExpr.name.lexeme, new Expr[] { assignExpr.value }));
 }
Example #5
0
 public object VisitAssignExpr(Expr.AssignExpr expr)
 {
     Resolve(expr.Value);
     ResolveLocal(expr, expr.Name);
     return(null);
 }