/**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public override Value eval(Env env)
        {
            Value array = _expr.eval(env);
            Value index = _index.eval(env);

            return(array.get(index));
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public override Value eval(Env env)
        {
            if (!_value.isVar())
            {
                env.error(L.l("each() argument must be a variable at '{0}'", _value));
                return(NullValue.NULL);
            }

            Value value = _value.eval(env);

            _listHead.evalAssignEachValue(env, value);

            return(value);
        }
        public override Value eval(Env env)
        {
            Value value = _value.eval(env);

            StringValue sb = value.ToStringBuilder(env);

            for (BinaryAppendExpr ptr = _next; ptr != null; ptr = ptr._next)
            {
                Value ptrValue = ptr._value.eval(env);

                sb = sb.appendUnicode(ptrValue);
            }

            return(sb);
        }
Пример #4
0
        /**
         * Evaluates the expression as an array index unset
         */
        public void evalUnsetArray(Env env, Expr indexExpr)
        {
            Value array = evalDirty(env);
            Value index = indexExpr.eval(env);

            array.remove(index);
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public bool evalBoolean(Env env)
        {
            Value array = _expr.eval(env);
            Value index = _index.eval(env);

            return(array.get(index) != UnsetValue.UNSET);
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value eval(Env env)
        {
            Value array = _expr.eval(env);
            Value index = _index.eval(env);

            return(array.remove(index));
        }
Пример #7
0
        /**
         * Evaluates the expression as an array index unset
         */
        public override void evalUnsetArray(Env env, Expr indexExpr)
        {
            Value obj   = _objExpr.eval(env);
            Value index = indexExpr.eval(env);

            obj.unsetArray(env, _name, index);
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value evalImpl(Env env, bool isRef, bool isCopy)
        {
            Value value = _name.eval(env);

            Value [] args = evalArgs(env, _args);

            env.pushCall(this, NullValue.NULL, null);

            try {
                env.checkTimeout();

                if (isRef)
                {
                    return(value.callRef(env, args));
                }
                else if (isCopy)
                {
                    return(value.call(env, args).copyReturn());
                }
                else
                {
                    return(value.call(env, args).toValue());
                }
            } finally {
                env.popCall();
            }
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value eval(Env env)
        {
            Value value = _value.eval(env);

            _listHead.evalAssignValue(env, value);

            return(value);
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public override Value eval(Env env)
        {
            Value obj = _objExpr.eval(env);

            StringValue methodName = _methodName;

            int hash = methodName.hashCodeCaseInsensitive();

            return(eval(env, obj, methodName, hash, _args));
        }
 /**
  * Evaluates the expression.
  *
  * @param env the calling environment.
  *
  * @return the expression value.
  */
 public Value eval(Env env)
 {
     if (_test.evalBoolean(env))
     {
         return(_trueExpr.eval(env));
     }
     else
     {
         return(_falseExpr.eval(env));
     }
 }
Пример #12
0
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value eval(Env env)
        {
            if (_value != null)
            {
                Value msg = _value.eval(env);

                return(env.exit(msg));
            }
            else
            {
                return(env.exit());
            }
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value eval(Env env)
        {
            Value value = _test.eval(env);

            if (value.toBoolean())
            {
                return(value.copy()); // php/03cj, php/03ck
            }
            else
            {
                return(_falseExpr.evalCopy(env)); // php/03cl
            }
        }
Пример #14
0
        /**
         * Evaluates as an array index assign ($a[index] = &value).
         */
        public override Value evalArrayAssignRef(Env env, Expr indexExpr, Expr valueExpr)
        {
            Value obj = env.getThis();

            StringValue name = evalName(env);

            Value fieldVar = obj.getThisFieldArray(env, name);
            Value index    = indexExpr.eval(env);

            Value value = valueExpr.evalRef(env);

            // php/03mn
            return(fieldVar.putThisFieldArray(env, obj, name, index, value));
        }
Пример #15
0
        /**
         * Evaluates as an array index assign ($a[index] = value).
         * @return what was assigned
         */
        public Value evalArrayAssignRef(Env env, Expr indexExpr, Value value)
        {
            // php/03mk, php/03mm, php/03mn, php/04b3
            // overrided in ThisFieldExpr and ThisFieldVarExpr
            //Value var = eval(env);
            //
            //return var.put(index, value);

            Value array = evalArray(env);
            Value index = indexExpr.eval(env);

            Value result = array.put(index, value);

            //return array.get(index); // php/03mm php/03mn

            return(result);
        }
        /**
         * Evaluates as an array index assign ($a[index] = value).
         */
        public override Value evalArrayAssignRef(Env env, Expr indexExpr, Expr valueExpr)
        {
            init();

            Value obj = env.getThis();

            if (obj.isNull())
            {
                return(env.thisError(getLocation()));
            }

            // php/044i
            Value fieldVar = obj.getThisFieldArray(env, _name);
            Value index    = indexExpr.eval(env);

            Value value = valueExpr.evalRef(env);

            return(fieldVar.putThisFieldArray(env, obj, _name, index, value));
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value eval(Env env)
        {
            Value [] values = new Value[_args.length];

            for (int i = 0; i < values.length; i++)
            {
                values[i] = _args[i].evalArg(env, true);
            }

            StringValue methodName = _name.eval(env).ToStringValue(env);

            Value obj = _objExpr.eval(env);

            env.pushCall(this, obj, values);

            try {
                env.checkTimeout();

                return(obj.callMethod(env, methodName, values));
            } finally {
                env.popCall();
            }
        }
Пример #18
0
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value eval(Env env)
        {
            Value obj = _objExpr.eval(env);

            return(obj.getField(env, _nameExpr.evalStringValue(env)));
        }
Пример #19
0
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public override Value eval(Env env)
        {
            Value obj = _objExpr.eval(env);

            return(obj.charValueAt(_indexExpr.evalLong(env)));
        }
Пример #20
0
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public override Value eval(Env env)
        {
            Value obj = _objExpr.eval(env);

            return(obj.getField(env, _name));
        }