Esempio n. 1
0
        public object visitSetExpr(Expr.Set expr)
        {
            object object_ = evaluate(expr.object_);

            if (!(object_ is LoxInstance))
            {
                throw new RuntimeError(expr.name, "Only instances have fields.");
            }

            object value = evaluate(expr.value);

            ((LoxInstance)object_).set(expr.name, value);
            return(value);
        }
Esempio n. 2
0
 public string visitSetExpr(Expr.Set expr)
 {
     return("");
 }
Esempio n. 3
0
 public object visitSetExpr(Expr.Set expr)
 {
     resolve(expr.value);
     resolve(expr.object_);
     return(null);
 }