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

            if (locals.TryGetValue(expr, out int distance))
            {
                environment.AssignAt(distance, expr.Name, value);
            }
            else
            {
                Globals.Assign(expr.Name, value);
            }

            return(value);
        }
예제 #2
0
 public string VisitAssignExpr(Expr.Assign expr)
 {
     throw new System.NotImplementedException();
 }
예제 #3
0
 public Nothing VisitAssignExpr(Expr.Assign expr)
 {
     Resolve(expr.Value);
     ResolveLocal(expr, expr.Name);
     return(Nothing.AtAll);
 }