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