public object Visit(Expr.Set _set) { Resolve(_set.value); Resolve(_set.target); return(null); }
public object VisitSetExpr(Expr.Set expr) { var obj = Evaluate(expr.Obj); if (obj is LoxInstance li) { var value = Evaluate(expr.Value); li.Set(expr.Name, value); return(value); } throw new RuntimeError(expr.Name, "Only instances have fields."); }
public object VisitSetExpr(Expr.Set expr) { object obj = Evaluate(expr.obj); if (obj is LoxInstance instance) { object value = Evaluate(expr.value); instance[expr.name] = value; return(value); } throw new RuntimeError(expr.name, "Only instances have fields."); }
public object visitSetExpr(Expr.Set set) { Object _object = evaluate(set._object); if (!(_object is LoxInstance) || (_object is LoxClass)) { throw new Exceptions.RuntimeError(set.name, "Only instances have fields."); } Object value = evaluate(set.value); ((LoxInstance)_object).set(set.name, value); return(value); }
object Expr.IVisitor <object> .Visit(Expr.Set _set) { object target = Evaluate(_set.target); if (!(target is LoxInstance)) { throw new RuntimeError(_set.name, "Only instances have fields."); } object value = Evaluate(_set.value); ((LoxInstance)target).Set(_set.name, value); return(value); }
string Expr.IVisitor <string> .Visit(Expr.Set _set) { throw new NotImplementedException(); }
public object visitSetExpr(Expr.Set set) { resolve(set.value); resolve(set._object); return(null); }
public object VisitSetExpr(Expr.Set expr) { Resolve(expr.value); Resolve(expr.obj); return(null); }
public string visitSetExpr(Expr.Set set) { return("(= " + set._object.accept(this) + "." + set.name.lexeme + " " + set.value.accept(this) + ")"); }
public Void VisitSetExpr(Expr.Set expr) { Resolve(expr.Value); Resolve(expr.Obj); return(null); }
public string VisitSetExpr(Expr.Set expr) { return($"({expr.obj.Accept(this)}{expr.name} <- {expr.value.Accept(this)})"); }