GetObject2() private method

private GetObject2 ( ) : Object
return Object
Esempio n. 1
0
        internal override object Evaluate()
        {
            object obj3;

            if ((this.outParameterCount > 0) && VsaEngine.executeForJSEE)
            {
                throw new JScriptException(JSError.RefParamsNonSupportedInDebugger);
            }
            LateBinding callee = this.func.EvaluateAsLateBinding();

            object[] objArray = (this.args == null) ? null : this.args.EvaluateAsArray();
            base.Globals.CallContextStack.Push(new CallContext(base.context, callee, objArray));
            try
            {
                object             obj2 = null;
                CallableExpression func = this.func as CallableExpression;
                if ((func == null) || !(func.expression is Call))
                {
                    obj2 = callee.Call(objArray, this.isConstructor, this.inBrackets, base.Engine);
                }
                else
                {
                    obj2 = LateBinding.CallValue(callee.obj, objArray, this.isConstructor, this.inBrackets, base.Engine, func.GetObject2(), JSBinder.ob, null, null);
                }
                if (this.outParameterCount > 0)
                {
                    int index = 0;
                    int count = this.args.count;
                    while (index < count)
                    {
                        if (this.args[index] is AddressOf)
                        {
                            this.args[index].SetValue(objArray[index]);
                        }
                        index++;
                    }
                }
                obj3 = obj2;
            }
            catch (TargetInvocationException exception)
            {
                JScriptException innerException;
                if (exception.InnerException is JScriptException)
                {
                    innerException = (JScriptException)exception.InnerException;
                    if (innerException.context == null)
                    {
                        if (innerException.Number == -2146823281)
                        {
                            innerException.context = this.func.context;
                        }
                        else
                        {
                            innerException.context = base.context;
                        }
                    }
                }
                else
                {
                    innerException = new JScriptException(exception.InnerException, base.context);
                }
                throw innerException;
            }
            catch (JScriptException exception3)
            {
                if (exception3.context == null)
                {
                    if (exception3.Number == -2146823281)
                    {
                        exception3.context = this.func.context;
                    }
                    else
                    {
                        exception3.context = base.context;
                    }
                }
                throw exception3;
            }
            catch (Exception exception4)
            {
                throw new JScriptException(exception4, base.context);
            }
            finally
            {
                base.Globals.CallContextStack.Pop();
            }
            return(obj3);
        }
Esempio n. 2
0
        internal override Object Evaluate()
        {
            if (this.outParameterCount > 0 && VsaEngine.executeForJSEE)
            {
                throw new JScriptException(JSError.RefParamsNonSupportedInDebugger);
            }
            LateBinding funcref = this.func.EvaluateAsLateBinding();

            Object[] actual_arguments = this.args == null ? null : this.args.EvaluateAsArray();
            Globals.CallContextStack.Push(new CallContext(this.context, funcref, actual_arguments));
            try{
                try{
                    Object             result = null;
                    CallableExpression cexpr  = this.func as CallableExpression;
                    if (cexpr == null || !(cexpr.expression is Call))
                    {
                        result = funcref.Call(actual_arguments, this.isConstructor, this.inBrackets, this.Engine);
                    }
                    else
                    {
                        result = LateBinding.CallValue(funcref.obj, actual_arguments, this.isConstructor, this.inBrackets, this.Engine,
                                                       cexpr.GetObject2(), JSBinder.ob, null, null);
                    }
                    if (this.outParameterCount > 0)
                    {
                        for (int i = 0, n = this.args.count; i < n; i++)
                        {
                            if (this.args[i] is AddressOf)
                            {
                                this.args[i].SetValue(actual_arguments[i]);
                            }
                        }
                    }
                    return(result);
                }catch (TargetInvocationException e) {
                    JScriptException se;
                    if (e.InnerException is JScriptException)
                    {
                        se = (JScriptException)e.InnerException;
                        if (se.context == null)
                        {
                            if (((uint)se.Number) == (0x800A0000 | (uint)JSError.ObjectExpected))
                            {
                                se.context = this.func.context;
                            }
                            else
                            {
                                se.context = this.context;
                            }
                        }
                    }
                    else
                    {
                        se = new JScriptException(e.InnerException, this.context);
                    }
                    throw se;
                }catch (JScriptException e) {
                    if (e.context == null)
                    {
                        if (((uint)e.Number) == (0x800A0000 | (uint)JSError.ObjectExpected))
                        {
                            e.context = this.func.context;
                        }
                        else
                        {
                            e.context = this.context;
                        }
                    }
                    throw e;
                }catch (Exception e) {
                    throw new JScriptException(e, this.context);
                }catch {
                    throw new JScriptException(JSError.NonClsException, this.context);
                }
            }finally{
                Globals.CallContextStack.Pop();
            }
        }