public object VisitAssignExpression(Expression.Assign expression) { object value = Evaluate(expression.value); bool distance_exists = locals.TryGetValue(expression, out int distance); if (distance_exists) { environment.AssignAt(distance, expression.name, value); } else { globals.Assign(expression.name, value); } return(value); }
public object VisitAssignExpr(Expression.Assign expr) { object value = Evaluate(expr); /* Statements and State visit-assign < Resolving and Binding resolved-assign * environment.assign(expr.name, value); */ //> Resolving and Binding resolved-assign locals.TryGetValueEx(expr, out int?distance); if (distance != null) { environment.AssignAt(distance.Value, expr.name, value); } else { globals.Assign(expr.name, value); } //< Resolving and Binding resolved-assign return(value); }
public string VisitAssignExpression(Expression.Assign expression) { throw new NotImplementedException(); }
public object VisitAssignExpression(Expression.Assign expression) { Resolve(expression.value); ResolveLocal(expression, expression.name); return(null); }
public object VisitAssignExpr(Expression.Assign expr) { throw new NotImplementedException("Resolver assign is not implemented"); }