Exemplo n.º 1
0
        public object VisitSetExpr(Expr.Set expr)
        {
            Resolve(expr.value);
            Resolve(expr.obj);

            return(null);
        }
Exemplo n.º 2
0
        public LoxVoid VisitSetExpr(Expr.Set expr)
        {
            Resolve(expr.Value);
            Resolve(expr.Instance);

            return(null);
        }
Exemplo n.º 3
0
        public object visitSetExpr(Expr.Set setExpr)
        {
            compile(setExpr.object_);
            compile(setExpr.value);

            captureToken(setExpr.name);

            byte name = identifierConstant(setExpr.name);

            emitBytes((byte)OpCode.OP_SET_PROPERTY, name);

            return(null);
        }
Exemplo n.º 4
0
        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 RuntimeException(expr.name, "Only instances have fields.");
        }
Exemplo n.º 5
0
        public object VisitSetExpr(Expr.Set expr)
        {
            object instanceObj = Evalutate(expr.Instance);

            if (instanceObj is LoxInstance instance)
            {
                object value = Evalutate(expr.Value);
                instance.Set(expr.Name, value);

                return(value);
            }

            throw new RuntimeError(expr.Name, "Only instnaces have fields.");
        }
Exemplo n.º 6
0
        public object Visit(Expr.Set expr)
        {
            object obj = Evaluate(expr.Object);

            if (!(obj is LoxInstance))
            {
                throw new RuntimeErrorException(expr.Name, "only instances have fields.");
            }

            object value = Evaluate(expr.Value);

            ((LoxInstance)obj).Set(expr.Name, value);
            return(value);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public object VisitSetExpr(Expr.Set expr)
        {
            object obj = Evaluate(expr.Obj);

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

            object value = Evaluate(expr.Value);

            ((LoxInstance)obj).Set(expr.Name, value);
            return(value);
        }
Exemplo n.º 9
0
    public object VisitSetExpr(Expr.Set expr)
    {
        object expression = Evaluate(expr.Expression);

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

        object value = Evaluate(expr.Value);

        ((LoxInstance)expression).Set(expr.Name, value);
        return(value);
    }
Exemplo n.º 10
0
 public Unit VisitSetExpr(Expr.Set expr)
 {
     Resolve(expr.Value);
     Resolve(expr.Object);
     return(new Unit());
 }
Exemplo n.º 11
0
 public object VisitSetExpr(Expr.Set expr, object options)
 {
     return(Parenthesize2("=", expr.obj, expr.token.lexeme, expr.value));
 }
Exemplo n.º 12
0
 public string visitSetExpr(Expr.Set expr)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
 public Token visitSetExpr(Expr.Set set)
 {
     return(set.name);
 }
Exemplo n.º 14
0
 public object VisitSetExpr(Expr.Set expr, object options = null)
 {
     return(null);
 }
Exemplo n.º 15
0
 public object VisitSetExpr(Expr.Set expr)
 {
     Resolve(expr.Value);
     Resolve(expr.Expression);
     return(null);
 }
Exemplo n.º 16
0
 public string VisitSetExpr(Expr.Set expr)
 {
     return($"{PrintExpr(expr.Instance)}.{expr.Name.Lexeme}");
 }
Exemplo n.º 17
0
 public string VisitSetExpr(Expr.Set expr)
 {
     return(Parenthesize("set", expr.@object, expr.value));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Resolve a property set
 /// </summary>
 /// <param name="expr"></param>
 /// <returns></returns>
 public object Visit(Expr.Set expr)
 {
     Resolve(expr.Value);
     Resolve(expr.Object);
     return(null);
 }
Exemplo n.º 19
0
 public object visitSetExpr(Expr.Set expr)
 {
     resolve(expr.value);
     resolve(expr.object_);
     return(null);
 }