Example #1
0
        public object VisitAssignExpr(Expr.Assign expr)
        {
            object value = Evaluate(expr.Value);

            int?distance = _locals[expr];

            if (distance != null)
            {
                _environment.AssignAt((int)distance, expr.Name, value);
            }
            else
            {
                Globals.Assign(expr.Name, value);
            }
            return(value);
        }
Example #2
0
 public object VisitAssignExpr(Expr.Assign expr)
 {
     Resolve(expr.Value);
     ResolveLocal(expr, expr.Name);
     return(null);
 }
Example #3
0
 public string Visit(Expr.Assign expr)
 {
     throw new NotImplementedException();
 }