Пример #1
0
        public object VisitSetExpr(Expr.Set expr)
        {
            object objekt = Evaluate(expr.ExprObject);

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

            object value = Evaluate(expr.Value);

            ((LoxInstance)objekt).Set(expr.Name, value);

            return(value);
        }
Пример #2
0
 public string VisitSetExpr(Expr.Set expr)
 {
     throw new System.NotImplementedException();
 }
Пример #3
0
 public Nothing VisitSetExpr(Expr.Set expr)
 {
     Resolve(expr.Value);
     Resolve(expr.ExprObject);
     return(Nothing.AtAll);
 }