Beispiel #1
0
        public object visitSetExpr(Expr.Set expr)
        {
            object instance = Evaluate(expr.instance);

            if (instance is LoxInstance loxInstance)
            {
                object value = Evaluate(expr.value);
                loxInstance.Set(expr.name, value);
                return(value);
            }
            throw new RuntimeError(expr.name, "Only instances have fields.");
        }
Beispiel #2
0
 public object visitSetExpr(Expr.Set expr)
 {
     Resolve(expr.value);
     Resolve(expr.instance);
     return(null);
 }
Beispiel #3
0
 public string visitSetExpr(Expr.Set expr)
 {
     throw new NotImplementedException();
 }