Пример #1
0
        internal static object NewWithSpecial(Context cx, IScriptable scope, object [] args)
        {
            ScriptRuntime.checkDeprecated(cx, "With");
            scope = ScriptableObject.GetTopLevelScope(scope);
            BuiltinWith thisObj = new BuiltinWith();

            thisObj.SetPrototype(args.Length == 0 ? ScriptableObject.getClassPrototype(scope, "Object") : ScriptConvert.ToObject(cx, scope, args [0]));
            thisObj.ParentScope = scope;
            return(thisObj);
        }
Пример #2
0
        public override object ExecIdCall(IdFunctionObject f, Context cx, IScriptable scope, IScriptable thisObj, object [] args)
        {
            if (!f.HasTag(CALL_TAG))
            {
                return(base.ExecIdCall(f, cx, scope, thisObj, args));
            }
            int id = f.MethodId;

            if (id == Id_constructor)
            {
                if (thisObj != null)
                {
                    throw Context.ReportRuntimeErrorById("msg.only.from.new", "Call");
                }
                ScriptRuntime.checkDeprecated(cx, "Call");
                BuiltinCall result = new BuiltinCall();
                result.SetPrototype(GetObjectPrototype(scope));
                return(result);
            }
            throw new ArgumentException(Convert.ToString(id));
        }