/**
         * 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));
            }

            StringValue nameV = _nameV;

            AbstractFunction fun = cl.getFunction(nameV);

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

            Value qThis = env.getThis();

            env.pushCall(this, qThis, values);

            try {
                env.checkTimeout();

                return(cl.callMethod(env, qThis, nameV, nameV.hashCode(), values));
            } finally {
                env.popCall();
            }
        }
        public AbstractIteratorImpl(Env env,
                                    ObjectValue obj)
        {
            _env    = env;
            _qClass = obj.getQuercusClass();
            _obj    = obj;

            if (!obj.isA(env, "iterator"))
            {
                throw new IllegalStateException(L.l("'{0}' @is an invalid iterator", obj));
            }

            _currentFun = _qClass.getFunction(env.createString("current"));
            _keyFun     = _qClass.getFunction(env.createString("key"));
            _nextFun    = _qClass.getFunction(env.createString("next"));
            _rewindFun  = _qClass.getFunction(env.createString("rewind"));
            _validFun   = _qClass.getFunction(env.createString("valid"));

            _rewindFun.callMethod(_env, _qClass, _obj);

            _needNext = false;
        }
Exemple #3
0
        public ReflectionMethod getMethod(Env env, StringValue name)
        {
            AbstractFunction fun = _cls.findFunction(name);

            if (fun == null)
            {
                throw new QuercusLanguageException(
                          env.createException("ReflectionException",
                                              L.l("method {0}::{1}() does not exist",
                                                  _name,
                                                  name)));
            }

            return(new ReflectionMethod(_name, _cls.getFunction(name)));
        }
 private AbstractFunction getMethod()
 {
     return(_qClass.getFunction(_methodName));
 }