Пример #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);
        }
Пример #2
0
 public string visitSetExpr(Expr.Set expr)
 {
     return("");
 }
Пример #3
0
 public object visitSetExpr(Expr.Set expr)
 {
     resolve(expr.value);
     resolve(expr.object_);
     return(null);
 }