Exemple #1
0
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public override Value eval(Env env)
        {
            QuercusClass cl = env.findClass(_className);

            if (cl == null)
            {
                env.error(L.l("no matching class {0}", _className), getLocation());
            }

            // qa/0954 - static calls pass the current $this
            Value qThis = env.getThis();

            StringValue methodName = _nameExpr.evalStringValue(env);

            Value [] args = evalArgs(env, _args);
            int      hash = methodName.hashCodeCaseInsensitive();

            return(cl.callStaticMethod(env, qThis, methodName, hash, args));
        }
Exemple #2
0
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value eval(Env env)
        {
            QuercusClass cl = env.findClass(_className);

            if (cl == null)
            {
                throw env.createErrorException(L.l("{0} @is an unknown class",
                                                   _className));
            }

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

            Value oldThis = env.getThis();

            // php/09qe
            Value qThis = oldThis;

            /*
             * if (oldThis.isNull()) {
             * qThis = cl;
             * env.setThis(qThis);
             * }
             * else
             * qThis = oldThis;
             */

            // php/024b
            // qThis = cl;

            env.pushCall(this, cl, values);
            // QuercusClass oldClass = env.setCallingClass(cl);

            try {
                env.checkTimeout();

                return(cl.callStaticMethod(env, qThis, _methodName, _hash, values));
            } finally {
                env.popCall();
                env.setThis(oldThis);
                // env.setCallingClass(oldClass);
            }
        }
        /**
         * Evaluates the expression.
         *
         * @param env the calling environment.
         *
         * @return the expression value.
         */
        public Value eval(Env env)
        {
            QuercusClass cls = env.getThis().getQuercusClass();

            QuercusClass parent = cls.getTraitParent(env, _traitName);

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

            Value oldThis = env.getThis();

            // XXX: 2013-03-14 nam: ugly, ugly, clean this up
            // php/09qe
            Value qThis = oldThis;

            /*
             * if (oldThis.isNull()) {
             * qThis = cl;
             * env.setThis(qThis);
             * }
             * else
             * qThis = oldThis;
             */
            // php/024b
            // qThis = cl;

            env.pushCall(this, parent, values);
            // QuercusClass oldClass = env.setCallingClass(cl);

            try {
                env.checkTimeout();

                return(parent.callStaticMethod(env, qThis, _methodName, _hash, values));
            } finally {
                env.popCall();
                env.setThis(oldThis);
                // env.setCallingClass(oldClass);
            }
        }