MethodId() public method

public MethodId ( ) : int
return int
示例#1
0
		public static bool IsContinuationConstructor(IdFunctionObject f)
		{
			if (f.HasTag(FTAG) && f.MethodId() == Id_constructor)
			{
				return true;
			}
			return false;
		}
示例#2
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable 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.ReportRuntimeError1("msg.only.from.new", "Call");
				}
				ScriptRuntime.CheckDeprecated(cx, "Call");
				Rhino.NativeCall result = new Rhino.NativeCall();
				result.SetPrototype(GetObjectPrototype(scope));
				return result;
			}
			throw new ArgumentException(id.ToString());
		}
示例#3
0
		public virtual object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (f.HasTag(FTAG))
			{
				if (f.MethodId() == Id_constructor)
				{
					throw Context.ReportRuntimeError1("msg.cant.call.indirect", "With");
				}
			}
			throw f.Unknown();
		}
示例#4
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(FTAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case Id_constructor:
				{
					throw Context.ReportRuntimeError("Direct call is not supported");
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#5
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(ITERATOR_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			if (id == Id_constructor)
			{
				return JsConstructor(cx, scope, thisObj, args);
			}
			if (!(thisObj is NativeIterator))
			{
				throw IncompatibleCallError(f);
			}
			NativeIterator iterator = (NativeIterator)thisObj;
			switch (id)
			{
				case Id_next:
				{
					return iterator.Next(cx, scope);
				}

				case Id___iterator__:
				{
					/// XXX: what about argument? SpiderMonkey apparently ignores it
					return thisObj;
				}

				default:
				{
					throw new ArgumentException(id.ToString());
				}
			}
		}
示例#6
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(DATE_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case ConstructorId_now:
				{
					return ScriptRuntime.WrapNumber(Now());
				}

				case ConstructorId_parse:
				{
					string dataStr = ScriptRuntime.ToString(args, 0);
					return ScriptRuntime.WrapNumber(Date_parseString(dataStr));
				}

				case ConstructorId_UTC:
				{
					return ScriptRuntime.WrapNumber(JsStaticFunction_UTC(args));
				}

				case Id_constructor:
				{
					// if called as a function, just return a string
					// representing the current time.
					if (thisObj != null)
					{
						return Date_format(Now(), Id_toString);
					}
					return JsConstructor(args);
				}

				case Id_toJSON:
				{
					if (thisObj is Rhino.NativeDate)
					{
						return ((Rhino.NativeDate)thisObj).ToISOString();
					}
					string toISOString = "toISOString";
					Scriptable o = ScriptRuntime.ToObject(cx, scope, thisObj);
					object tv = ScriptRuntime.ToPrimitive(o, ScriptRuntime.NumberClass);
					if (tv is Number)
					{
						double d = System.Convert.ToDouble(((Number)tv));
						if (d != d || System.Double.IsInfinity(d))
						{
							return null;
						}
					}
					object toISO = o.Get(toISOString, o);
					if (toISO == ScriptableConstants.NOT_FOUND)
					{
						throw ScriptRuntime.TypeError2("msg.function.not.found.in", toISOString, ScriptRuntime.ToString(o));
					}
					if (!(toISO is Callable))
					{
						throw ScriptRuntime.TypeError3("msg.isnt.function.in", toISOString, ScriptRuntime.ToString(o), ScriptRuntime.ToString(toISO));
					}
					object result = ((Callable)toISO).Call(cx, scope, o, ScriptRuntime.emptyArgs);
					if (!ScriptRuntime.IsPrimitive(result))
					{
						throw ScriptRuntime.TypeError1("msg.toisostring.must.return.primitive", ScriptRuntime.ToString(result));
					}
					return result;
				}
			}
			// The rest of Date.prototype methods require thisObj to be Date
			if (!(thisObj is Rhino.NativeDate))
			{
				throw IncompatibleCallError(f);
			}
			Rhino.NativeDate realThis = (Rhino.NativeDate)thisObj;
			double t = realThis.date;
			switch (id)
			{
				case Id_toString:
				case Id_toTimeString:
				case Id_toDateString:
				{
					if (t == t)
					{
						return Date_format(t, id);
					}
					return js_NaN_date_str;
				}

				case Id_toLocaleString:
				case Id_toLocaleTimeString:
				case Id_toLocaleDateString:
				{
					if (t == t)
					{
						return ToLocale_helper(t, id);
					}
					return js_NaN_date_str;
				}

				case Id_toUTCString:
				{
					if (t == t)
					{
						return Js_toUTCString(t);
					}
					return js_NaN_date_str;
				}

				case Id_toSource:
				{
					return "(new Date(" + ScriptRuntime.ToString(t) + "))";
				}

				case Id_valueOf:
				case Id_getTime:
				{
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getYear:
				case Id_getFullYear:
				case Id_getUTCFullYear:
				{
					if (t == t)
					{
						if (id != Id_getUTCFullYear)
						{
							t = LocalTime(t);
						}
						t = YearFromTime(t);
						if (id == Id_getYear)
						{
							if (cx.HasFeature(Context.FEATURE_NON_ECMA_GET_YEAR))
							{
								if (1900 <= t && t < 2000)
								{
									t -= 1900;
								}
							}
							else
							{
								t -= 1900;
							}
						}
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getMonth:
				case Id_getUTCMonth:
				{
					if (t == t)
					{
						if (id == Id_getMonth)
						{
							t = LocalTime(t);
						}
						t = MonthFromTime(t);
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getDate:
				case Id_getUTCDate:
				{
					if (t == t)
					{
						if (id == Id_getDate)
						{
							t = LocalTime(t);
						}
						t = DateFromTime(t);
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getDay:
				case Id_getUTCDay:
				{
					if (t == t)
					{
						if (id == Id_getDay)
						{
							t = LocalTime(t);
						}
						t = WeekDay(t);
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getHours:
				case Id_getUTCHours:
				{
					if (t == t)
					{
						if (id == Id_getHours)
						{
							t = LocalTime(t);
						}
						t = HourFromTime(t);
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getMinutes:
				case Id_getUTCMinutes:
				{
					if (t == t)
					{
						if (id == Id_getMinutes)
						{
							t = LocalTime(t);
						}
						t = MinFromTime(t);
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getSeconds:
				case Id_getUTCSeconds:
				{
					if (t == t)
					{
						if (id == Id_getSeconds)
						{
							t = LocalTime(t);
						}
						t = SecFromTime(t);
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getMilliseconds:
				case Id_getUTCMilliseconds:
				{
					if (t == t)
					{
						if (id == Id_getMilliseconds)
						{
							t = LocalTime(t);
						}
						t = MsFromTime(t);
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_getTimezoneOffset:
				{
					if (t == t)
					{
						t = (t - LocalTime(t)) / msPerMinute;
					}
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_setTime:
				{
					t = TimeClip(ScriptRuntime.ToNumber(args, 0));
					realThis.date = t;
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_setMilliseconds:
				case Id_setUTCMilliseconds:
				case Id_setSeconds:
				case Id_setUTCSeconds:
				case Id_setMinutes:
				case Id_setUTCMinutes:
				case Id_setHours:
				case Id_setUTCHours:
				{
					t = MakeTime(t, args, id);
					realThis.date = t;
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_setDate:
				case Id_setUTCDate:
				case Id_setMonth:
				case Id_setUTCMonth:
				case Id_setFullYear:
				case Id_setUTCFullYear:
				{
					t = MakeDate(t, args, id);
					realThis.date = t;
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_setYear:
				{
					double year = ScriptRuntime.ToNumber(args, 0);
					if (year != year || System.Double.IsInfinity(year))
					{
						t = ScriptRuntime.NaN;
					}
					else
					{
						if (t != t)
						{
							t = 0;
						}
						else
						{
							t = LocalTime(t);
						}
						if (year >= 0 && year <= 99)
						{
							year += 1900;
						}
						double day = MakeDay(year, MonthFromTime(t), DateFromTime(t));
						t = MakeDate(day, TimeWithinDay(t));
						t = InternalUTC(t);
						t = TimeClip(t);
					}
					realThis.date = t;
					return ScriptRuntime.WrapNumber(t);
				}

				case Id_toISOString:
				{
					return realThis.ToISOString();
				}

				default:
				{
					throw new ArgumentException(id.ToString());
				}
			}
		}
示例#7
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(JSON_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int methodId = f.MethodId();
			switch (methodId)
			{
				case Id_toSource:
				{
					return "JSON";
				}

				case Id_parse:
				{
					string jtext = ScriptRuntime.ToString(args, 0);
					object reviver = null;
					if (args.Length > 1)
					{
						reviver = args[1];
					}
					if (reviver is Callable)
					{
						return Parse(cx, scope, jtext, (Callable)reviver);
					}
					else
					{
						return Parse(cx, scope, jtext);
					}
					goto case Id_stringify;
				}

				case Id_stringify:
				{
					object value = null;
					object replacer = null;
					object space = null;
					switch (args.Length)
					{
						case 3:
						default:
						{
							space = args[2];
							goto case 2;
						}

						case 2:
						{
							replacer = args[1];
							goto case 1;
						}

						case 1:
						{
							value = args[0];
							goto case 0;
						}

						case 0:
						{
							break;
						}
					}
					return Stringify(cx, scope, value, replacer, space);
				}

				default:
				{
					throw new InvalidOperationException(methodId.ToString());
				}
			}
		}
示例#8
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(MATH_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			double x;
			int methodId = f.MethodId();
			switch (methodId)
			{
				case Id_toSource:
				{
					return "Math";
				}

				case Id_abs:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					// abs(-0.0) should be 0.0, but -0.0 < 0.0 == false
					x = (x == 0.0) ? 0.0 : (x < 0.0) ? -x : x;
					break;
				}

				case Id_acos:
				case Id_asin:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					if (x == x && -1.0 <= x && x <= 1.0)
					{
						x = (methodId == Id_acos) ? Math.Acos(x) : Math.Asin(x);
					}
					else
					{
						x = double.NaN;
					}
					break;
				}

				case Id_atan:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = Math.Atan(x);
					break;
				}

				case Id_atan2:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = Math.Atan2(x, ScriptRuntime.ToNumber(args, 1));
					break;
				}

				case Id_ceil:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = System.Math.Ceiling(x);
					break;
				}

				case Id_cos:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = (x == double.PositiveInfinity || x == double.NegativeInfinity) ? double.NaN : Math.Cos(x);
					break;
				}

				case Id_exp:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = (x == double.PositiveInfinity) ? x : (x == double.NegativeInfinity) ? 0.0 : Math.Exp(x);
					break;
				}

				case Id_floor:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = Math.Floor(x);
					break;
				}

				case Id_log:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					// Java's log(<0) = -Infinity; we need NaN
					x = (x < 0) ? double.NaN : Math.Log(x);
					break;
				}

				case Id_max:
				case Id_min:
				{
					x = (methodId == Id_max) ? double.NegativeInfinity : double.PositiveInfinity;
					for (int i = 0; i != args.Length; ++i)
					{
						double d = ScriptRuntime.ToNumber(args[i]);
						if (d != d)
						{
							x = d;
							// NaN
							break;
						}
						if (methodId == Id_max)
						{
							// if (x < d) x = d; does not work due to -0.0 >= +0.0
							x = Math.Max(x, d);
						}
						else
						{
							x = Math.Min(x, d);
						}
					}
					break;
				}

				case Id_pow:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = Js_pow(x, ScriptRuntime.ToNumber(args, 1));
					break;
				}

				case Id_random:
				{
					x = Math.Random();
					break;
				}

				case Id_round:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					if (x == x && x != double.PositiveInfinity && x != double.NegativeInfinity)
					{
						// Round only finite x
						long l = Math.Round(x);
						if (l != 0)
						{
							x = l;
						}
						else
						{
							// We must propagate the sign of d into the result
							if (x < 0.0)
							{
								x = ScriptRuntime.negativeZero;
							}
							else
							{
								if (x != 0.0)
								{
									x = 0.0;
								}
							}
						}
					}
					break;
				}

				case Id_sin:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = (x == double.PositiveInfinity || x == double.NegativeInfinity) ? double.NaN : Math.Sin(x);
					break;
				}

				case Id_sqrt:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = Math.Sqrt(x);
					break;
				}

				case Id_tan:
				{
					x = ScriptRuntime.ToNumber(args, 0);
					x = Math.Tan(x);
					break;
				}

				default:
				{
					throw new InvalidOperationException(methodId.ToString());
				}
			}
			return ScriptRuntime.WrapNumber(x);
		}
示例#9
0
		internal static bool IsApply(IdFunctionObject f)
		{
			return f.HasTag(FUNCTION_TAG) && f.MethodId() == Id_apply;
		}
示例#10
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(NUMBER_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			if (id == Id_constructor)
			{
				double val = (args.Length >= 1) ? ScriptRuntime.ToNumber(args[0]) : 0.0;
				if (thisObj == null)
				{
					// new Number(val) creates a new Number object.
					return new Rhino.NativeNumber(val);
				}
				// Number(val) converts val to a number value.
				return ScriptRuntime.WrapNumber(val);
			}
			// The rest of Number.prototype methods require thisObj to be Number
			if (!(thisObj is Rhino.NativeNumber))
			{
				throw IncompatibleCallError(f);
			}
			double value = ((Rhino.NativeNumber)thisObj).doubleValue;
			switch (id)
			{
				case Id_toString:
				case Id_toLocaleString:
				{
					// toLocaleString is just an alias for toString for now
					int @base = (args.Length == 0 || args[0] == Undefined.instance) ? 10 : ScriptRuntime.ToInt32(args[0]);
					return ScriptRuntime.NumberToString(value, @base);
				}

				case Id_toSource:
				{
					return "(new Number(" + ScriptRuntime.ToString(value) + "))";
				}

				case Id_valueOf:
				{
					return ScriptRuntime.WrapNumber(value);
				}

				case Id_toFixed:
				{
					return Num_to(value, args, DToA.DTOSTR_FIXED, DToA.DTOSTR_FIXED, -20, 0);
				}

				case Id_toExponential:
				{
					// Handle special values before range check
					if (double.IsNaN(value))
					{
						return "NaN";
					}
					if (System.Double.IsInfinity(value))
					{
						if (value >= 0)
						{
							return "Infinity";
						}
						else
						{
							return "-Infinity";
						}
					}
					// General case
					return Num_to(value, args, DToA.DTOSTR_STANDARD_EXPONENTIAL, DToA.DTOSTR_EXPONENTIAL, 0, 1);
				}

				case Id_toPrecision:
				{
					// Undefined precision, fall back to ToString()
					if (args.Length == 0 || args[0] == Undefined.instance)
					{
						return ScriptRuntime.NumberToString(value, 10);
					}
					// Handle special values before range check
					if (double.IsNaN(value))
					{
						return "NaN";
					}
					if (System.Double.IsInfinity(value))
					{
						if (value >= 0)
						{
							return "Infinity";
						}
						else
						{
							return "-Infinity";
						}
					}
					return Num_to(value, args, DToA.DTOSTR_STANDARD, DToA.DTOSTR_PRECISION, 1, 0);
				}

				default:
				{
					throw new ArgumentException(id.ToString());
				}
			}
		}
示例#11
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(REGEXP_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case Id_compile:
				{
					return RealThis(thisObj, f).Compile(cx, scope, args);
				}

				case Id_toString:
				case Id_toSource:
				{
					return RealThis(thisObj, f).ToString();
				}

				case Id_exec:
				{
					return RealThis(thisObj, f).ExecSub(cx, scope, args, MATCH);
				}

				case Id_test:
				{
					object x = RealThis(thisObj, f).ExecSub(cx, scope, args, TEST);
					return true.Equals(x) ? true : false;
				}

				case Id_prefix:
				{
					return RealThis(thisObj, f).ExecSub(cx, scope, args, PREFIX);
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#12
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(STRING_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			for (; ; )
			{
				switch (id)
				{
					case ConstructorId_charAt:
					case ConstructorId_charCodeAt:
					case ConstructorId_indexOf:
					case ConstructorId_lastIndexOf:
					case ConstructorId_split:
					case ConstructorId_substring:
					case ConstructorId_toLowerCase:
					case ConstructorId_toUpperCase:
					case ConstructorId_substr:
					case ConstructorId_concat:
					case ConstructorId_slice:
					case ConstructorId_equalsIgnoreCase:
					case ConstructorId_match:
					case ConstructorId_search:
					case ConstructorId_replace:
					case ConstructorId_localeCompare:
					case ConstructorId_toLocaleLowerCase:
					{
						if (args.Length > 0)
						{
							thisObj = ScriptRuntime.ToObject(scope, ScriptRuntime.ToCharSequence(args[0]));
							object[] newArgs = new object[args.Length - 1];
							for (int i = 0; i < newArgs.Length; i++)
							{
								newArgs[i] = args[i + 1];
							}
							args = newArgs;
						}
						else
						{
							thisObj = ScriptRuntime.ToObject(scope, ScriptRuntime.ToCharSequence(thisObj));
						}
						id = -id;
						goto again_continue;
					}

					case ConstructorId_fromCharCode:
					{
						int N = args.Length;
						if (N < 1)
						{
							return string.Empty;
						}
						StringBuilder sb = new StringBuilder(N);
						for (int i = 0; i != N; ++i)
						{
							sb.Append(ScriptRuntime.ToUint16(args[i]));
						}
						return sb.ToString();
					}

					case Id_constructor:
					{
						CharSequence s = (args.Length >= 1) ? ScriptRuntime.ToCharSequence(args[0]) : string.Empty;
						if (thisObj == null)
						{
							// new String(val) creates a new String object.
							return new Rhino.NativeString(s);
						}
						// String(val) converts val to a string value.
						return s is string ? s : s.ToString();
					}

					case Id_toString:
					case Id_valueOf:
					{
						// ECMA 15.5.4.2: 'the toString function is not generic.
						CharSequence cs = RealThis(thisObj, f).@string;
						return cs is string ? cs : cs.ToString();
					}

					case Id_toSource:
					{
						CharSequence s = RealThis(thisObj, f).@string;
						return "(new String(\"" + ScriptRuntime.EscapeString(s.ToString()) + "\"))";
					}

					case Id_charAt:
					case Id_charCodeAt:
					{
						// See ECMA 15.5.4.[4,5]
						CharSequence target = ScriptRuntime.ToCharSequence(thisObj);
						double pos = ScriptRuntime.ToInteger(args, 0);
						if (pos < 0 || pos >= target.Length)
						{
							if (id == Id_charAt)
							{
								return string.Empty;
							}
							else
							{
								return ScriptRuntime.NaNobj;
							}
						}
						char c = target[(int)pos];
						if (id == Id_charAt)
						{
							return c.ToString();
						}
						else
						{
							return ScriptRuntime.WrapInt(c);
						}
						goto case Id_indexOf;
					}

					case Id_indexOf:
					{
						return ScriptRuntime.WrapInt(Js_indexOf(ScriptRuntime.ToString(thisObj), args));
					}

					case Id_lastIndexOf:
					{
						return ScriptRuntime.WrapInt(Js_lastIndexOf(ScriptRuntime.ToString(thisObj), args));
					}

					case Id_split:
					{
						return ScriptRuntime.CheckRegExpProxy(cx).Js_split(cx, scope, ScriptRuntime.ToString(thisObj), args);
					}

					case Id_substring:
					{
						return Js_substring(cx, ScriptRuntime.ToCharSequence(thisObj), args);
					}

					case Id_toLowerCase:
					{
						// See ECMA 15.5.4.11
						return ScriptRuntime.ToString(thisObj).ToLower(ScriptRuntime.ROOT_LOCALE);
					}

					case Id_toUpperCase:
					{
						// See ECMA 15.5.4.12
						return ScriptRuntime.ToString(thisObj).ToUpper(ScriptRuntime.ROOT_LOCALE);
					}

					case Id_substr:
					{
						return Js_substr(ScriptRuntime.ToCharSequence(thisObj), args);
					}

					case Id_concat:
					{
						return Js_concat(ScriptRuntime.ToString(thisObj), args);
					}

					case Id_slice:
					{
						return Js_slice(ScriptRuntime.ToCharSequence(thisObj), args);
					}

					case Id_bold:
					{
						return Tagify(thisObj, "b", null, null);
					}

					case Id_italics:
					{
						return Tagify(thisObj, "i", null, null);
					}

					case Id_fixed:
					{
						return Tagify(thisObj, "tt", null, null);
					}

					case Id_strike:
					{
						return Tagify(thisObj, "strike", null, null);
					}

					case Id_small:
					{
						return Tagify(thisObj, "small", null, null);
					}

					case Id_big:
					{
						return Tagify(thisObj, "big", null, null);
					}

					case Id_blink:
					{
						return Tagify(thisObj, "blink", null, null);
					}

					case Id_sup:
					{
						return Tagify(thisObj, "sup", null, null);
					}

					case Id_sub:
					{
						return Tagify(thisObj, "sub", null, null);
					}

					case Id_fontsize:
					{
						return Tagify(thisObj, "font", "size", args);
					}

					case Id_fontcolor:
					{
						return Tagify(thisObj, "font", "color", args);
					}

					case Id_link:
					{
						return Tagify(thisObj, "a", "href", args);
					}

					case Id_anchor:
					{
						return Tagify(thisObj, "a", "name", args);
					}

					case Id_equals:
					case Id_equalsIgnoreCase:
					{
						string s1 = ScriptRuntime.ToString(thisObj);
						string s2 = ScriptRuntime.ToString(args, 0);
						return ScriptRuntime.WrapBoolean((id == Id_equals) ? s1.Equals(s2) : Sharpen.Runtime.EqualsIgnoreCase(s1, s2));
					}

					case Id_match:
					case Id_search:
					case Id_replace:
					{
						int actionType;
						if (id == Id_match)
						{
							actionType = RegExpProxyConstants.RA_MATCH;
						}
						else
						{
							if (id == Id_search)
							{
								actionType = RegExpProxyConstants.RA_SEARCH;
							}
							else
							{
								actionType = RegExpProxyConstants.RA_REPLACE;
							}
						}
						return ScriptRuntime.CheckRegExpProxy(cx).Action(cx, scope, thisObj, args, actionType);
					}

					case Id_localeCompare:
					{
						// ECMA-262 1 5.5.4.9
						// For now, create and configure a collator instance. I can't
						// actually imagine that this'd be slower than caching them
						// a la ClassCache, so we aren't trying to outsmart ourselves
						// with a caching mechanism for now.
						Collator collator = Collator.GetInstance(cx.GetLocale());
						collator.SetStrength(Collator.IDENTICAL);
						collator.SetDecomposition(Collator.CANONICAL_DECOMPOSITION);
						return ScriptRuntime.WrapNumber(collator.Compare(ScriptRuntime.ToString(thisObj), ScriptRuntime.ToString(args, 0)));
					}

					case Id_toLocaleLowerCase:
					{
						return ScriptRuntime.ToString(thisObj).ToLower(cx.GetLocale());
					}

					case Id_toLocaleUpperCase:
					{
						return ScriptRuntime.ToString(thisObj).ToUpper(cx.GetLocale());
					}

					case Id_trim:
					{
						string str = ScriptRuntime.ToString(thisObj);
						char[] chars = str.ToCharArray();
						int start = 0;
						while (start < chars.Length && ScriptRuntime.IsJSWhitespaceOrLineTerminator(chars[start]))
						{
							start++;
						}
						int end = chars.Length;
						while (end > start && ScriptRuntime.IsJSWhitespaceOrLineTerminator(chars[end - 1]))
						{
							end--;
						}
						return Sharpen.Runtime.Substring(str, start, end);
					}
				}
				throw new ArgumentException(id.ToString());
again_continue: ;
			}
again_break: ;
		}
示例#13
0
		public virtual object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (f.HasTag(FTAG))
			{
				int methodId = f.MethodId();
				switch (methodId)
				{
					case Id_decodeURI:
					case Id_decodeURIComponent:
					{
						string str = ScriptRuntime.ToString(args, 0);
						return Decode(str, methodId == Id_decodeURI);
					}

					case Id_encodeURI:
					case Id_encodeURIComponent:
					{
						string str = ScriptRuntime.ToString(args, 0);
						return Encode(str, methodId == Id_encodeURI);
					}

					case Id_escape:
					{
						return Js_escape(args);
					}

					case Id_eval:
					{
						return Js_eval(cx, scope, args);
					}

					case Id_isFinite:
					{
						bool result;
						if (args.Length < 1)
						{
							result = false;
						}
						else
						{
							double d = ScriptRuntime.ToNumber(args[0]);
							result = (d == d && d != double.PositiveInfinity && d != double.NegativeInfinity);
						}
						return ScriptRuntime.WrapBoolean(result);
					}

					case Id_isNaN:
					{
						// The global method isNaN, as per ECMA-262 15.1.2.6.
						bool result;
						if (args.Length < 1)
						{
							result = true;
						}
						else
						{
							double d = ScriptRuntime.ToNumber(args[0]);
							result = (d != d);
						}
						return ScriptRuntime.WrapBoolean(result);
					}

					case Id_isXMLName:
					{
						object name = (args.Length == 0) ? Undefined.instance : args[0];
						XMLLib xmlLib = XMLLib.ExtractFromScope(scope);
						return ScriptRuntime.WrapBoolean(xmlLib.IsXMLName(cx, name));
					}

					case Id_parseFloat:
					{
						return Js_parseFloat(args);
					}

					case Id_parseInt:
					{
						return Js_parseInt(args);
					}

					case Id_unescape:
					{
						return Js_unescape(args);
					}

					case Id_uneval:
					{
						object value = (args.Length != 0) ? args[0] : Undefined.instance;
						return ScriptRuntime.Uneval(cx, scope, value);
					}

					case Id_new_CommonError:
					{
						// The implementation of all the ECMA error constructors
						// (SyntaxError, TypeError, etc.)
						return NativeError.Make(cx, scope, f, args);
					}
				}
			}
			throw f.Unknown();
		}
示例#14
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(IMPORTER_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case Id_constructor:
				{
					return Js_construct(scope, args);
				}

				case Id_importClass:
				{
					return RealThis(thisObj, f).Js_importClass(args);
				}

				case Id_importPackage:
				{
					return RealThis(thisObj, f).Js_importPackage(args);
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#15
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(NAMESPACE_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case Id_constructor:
				{
					return JsConstructor(cx, (thisObj == null), args);
				}

				case Id_toString:
				{
					return RealThis(thisObj, f).ToString();
				}

				case Id_toSource:
				{
					return RealThis(thisObj, f).Js_toSource();
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#16
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(ERROR_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case Id_constructor:
				{
					return Make(cx, scope, f, args);
				}

				case Id_toString:
				{
					return Js_toString(thisObj);
				}

				case Id_toSource:
				{
					return Js_toSource(cx, scope, thisObj);
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#17
0
		internal static bool IsApplyOrCall(IdFunctionObject f)
		{
			if (f.HasTag(FUNCTION_TAG))
			{
				switch (f.MethodId())
				{
					case Id_apply:
					case Id_call:
					{
						return true;
					}
				}
			}
			return false;
		}
示例#18
0
		public void InitPrototypeConstructor(IdFunctionObject f)
		{
			int id = prototypeValues.constructorId;
			if (id == 0)
			{
				throw new InvalidOperationException();
			}
			if (f.MethodId() != id)
			{
				throw new ArgumentException();
			}
			if (IsSealed())
			{
				f.SealObject();
			}
			prototypeValues.InitValue(id, "constructor", f, DONTENUM);
		}
示例#19
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(FUNCTION_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case Id_constructor:
				{
					return JsConstructor(cx, scope, args);
				}

				case Id_toString:
				{
					Rhino.BaseFunction realf = RealFunction(thisObj, f);
					int indent = ScriptRuntime.ToInt32(args, 0);
					return realf.Decompile(indent, 0);
				}

				case Id_toSource:
				{
					Rhino.BaseFunction realf = RealFunction(thisObj, f);
					int indent = 0;
					int flags = Decompiler.TO_SOURCE_FLAG;
					if (args.Length != 0)
					{
						indent = ScriptRuntime.ToInt32(args[0]);
						if (indent >= 0)
						{
							flags = 0;
						}
						else
						{
							indent = 0;
						}
					}
					return realf.Decompile(indent, flags);
				}

				case Id_apply:
				case Id_call:
				{
					return ScriptRuntime.ApplyOrCall(id == Id_apply, cx, scope, thisObj, args);
				}

				case Id_bind:
				{
					if (!(thisObj is Callable))
					{
						throw ScriptRuntime.NotFunctionError(thisObj);
					}
					Callable targetFunction = (Callable)thisObj;
					int argc = args.Length;
					Scriptable boundThis;
					object[] boundArgs;
					if (argc > 0)
					{
						boundThis = ScriptRuntime.ToObjectOrNull(cx, args[0], scope);
						boundArgs = new object[argc - 1];
						System.Array.Copy(args, 1, boundArgs, 0, argc - 1);
					}
					else
					{
						boundThis = null;
						boundArgs = ScriptRuntime.emptyArgs;
					}
					return new BoundFunction(cx, scope, targetFunction, boundThis, boundArgs);
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#20
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(BOOLEAN_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			if (id == Id_constructor)
			{
				bool b;
				if (args.Length == 0)
				{
					b = false;
				}
				else
				{
					b = args[0] is ScriptableObject && ((ScriptableObject)args[0]).AvoidObjectDetection() ? true : ScriptRuntime.ToBoolean(args[0]);
				}
				if (thisObj == null)
				{
					// new Boolean(val) creates a new boolean object.
					return new Rhino.NativeBoolean(b);
				}
				// Boolean(val) converts val to a boolean.
				return ScriptRuntime.WrapBoolean(b);
			}
			// The rest of Boolean.prototype methods require thisObj to be Boolean
			if (!(thisObj is Rhino.NativeBoolean))
			{
				throw IncompatibleCallError(f);
			}
			bool value = ((Rhino.NativeBoolean)thisObj).booleanValue;
			switch (id)
			{
				case Id_toString:
				{
					return value ? "true" : "false";
				}

				case Id_toSource:
				{
					return value ? "(new Boolean(true))" : "(new Boolean(false))";
				}

				case Id_valueOf:
				{
					return ScriptRuntime.WrapBoolean(value);
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#21
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(SCRIPT_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case Id_constructor:
				{
					string source = (args.Length == 0) ? string.Empty : ScriptRuntime.ToString(args[0]);
					Script script = Compile(cx, source);
					Rhino.NativeScript nscript = new Rhino.NativeScript(script);
					ScriptRuntime.SetObjectProtoAndParent(nscript, scope);
					return nscript;
				}

				case Id_toString:
				{
					Rhino.NativeScript real = RealThis(thisObj, f);
					Script realScript = real.script;
					if (realScript == null)
					{
						return string.Empty;
					}
					return cx.DecompileScript(realScript, 0);
				}

				case Id_exec:
				{
					throw Context.ReportRuntimeError1("msg.cant.call.indirect", "exec");
				}

				case Id_compile:
				{
					Rhino.NativeScript real = RealThis(thisObj, f);
					string source = ScriptRuntime.ToString(args, 0);
					real.script = Compile(cx, source);
					return real;
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#22
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(GENERATOR_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			if (!(thisObj is NativeGenerator))
			{
				throw IncompatibleCallError(f);
			}
			NativeGenerator generator = (NativeGenerator)thisObj;
			switch (id)
			{
				case Id_close:
				{
					// need to run any pending finally clauses
					return generator.Resume(cx, scope, GENERATOR_CLOSE, new NativeGenerator.GeneratorClosedException());
				}

				case Id_next:
				{
					// arguments to next() are ignored
					generator.firstTime = false;
					return generator.Resume(cx, scope, GENERATOR_SEND, Undefined.instance);
				}

				case Id_send:
				{
					object arg = args.Length > 0 ? args[0] : Undefined.instance;
					if (generator.firstTime && !arg.Equals(Undefined.instance))
					{
						throw ScriptRuntime.TypeError0("msg.send.newborn");
					}
					return generator.Resume(cx, scope, GENERATOR_SEND, arg);
				}

				case Id_throw:
				{
					return generator.Resume(cx, scope, GENERATOR_THROW, args.Length > 0 ? args[0] : Undefined.instance);
				}

				case Id___iterator__:
				{
					return thisObj;
				}

				default:
				{
					throw new ArgumentException(id.ToString());
				}
			}
		}
示例#23
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(XMLCTOR_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			switch (id)
			{
				case Id_defaultSettings:
				{
					options.SetDefault();
					Scriptable obj = cx.NewObject(scope);
					WriteSetting(obj);
					return obj;
				}

				case Id_settings:
				{
					Scriptable obj = cx.NewObject(scope);
					WriteSetting(obj);
					return obj;
				}

				case Id_setSettings:
				{
					if (args.Length == 0 || args[0] == null || args[0] == Undefined.instance)
					{
						options.SetDefault();
					}
					else
					{
						if (args[0] is Scriptable)
						{
							ReadSettings((Scriptable)args[0]);
						}
					}
					return Undefined.instance;
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#24
0
		public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (!f.HasTag(XMLOBJECT_TAG))
			{
				return base.ExecIdCall(f, cx, scope, thisObj, args);
			}
			int id = f.MethodId();
			if (id == Id_constructor)
			{
				return JsConstructor(cx, thisObj == null, args);
			}
			// All (XML|XMLList).prototype methods require thisObj to be XML
			if (!(thisObj is Rhino.Xmlimpl.XMLObjectImpl))
			{
				throw IncompatibleCallError(f);
			}
			Rhino.Xmlimpl.XMLObjectImpl realThis = (Rhino.Xmlimpl.XMLObjectImpl)thisObj;
			XML xml = realThis.GetXML();
			switch (id)
			{
				case Id_appendChild:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "appendChild");
					}
					return xml.AppendChild(Arg(args, 0));
				}

				case Id_addNamespace:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "addNamespace");
					}
					Namespace ns = lib.CastToNamespace(cx, Arg(args, 0));
					return xml.AddNamespace(ns);
				}

				case Id_childIndex:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "childIndex");
					}
					return ScriptRuntime.WrapInt(xml.ChildIndex());
				}

				case Id_inScopeNamespaces:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "inScopeNamespaces");
					}
					return cx.NewArray(scope, ToObjectArray(xml.InScopeNamespaces()));
				}

				case Id_insertChildAfter:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "insertChildAfter");
					}
					object arg0 = Arg(args, 0);
					if (arg0 == null || arg0 is XML)
					{
						return xml.InsertChildAfter((XML)arg0, Arg(args, 1));
					}
					return Undefined.instance;
				}

				case Id_insertChildBefore:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "insertChildBefore");
					}
					object arg0 = Arg(args, 0);
					if (arg0 == null || arg0 is XML)
					{
						return xml.InsertChildBefore((XML)arg0, Arg(args, 1));
					}
					return Undefined.instance;
				}

				case Id_localName:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "localName");
					}
					return xml.LocalName();
				}

				case Id_name:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "name");
					}
					return xml.Name();
				}

				case Id_namespace:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "namespace");
					}
					string prefix = (args.Length > 0) ? ScriptRuntime.ToString(args[0]) : null;
					Namespace rv = xml.Namespace(prefix);
					if (rv == null)
					{
						return Undefined.instance;
					}
					else
					{
						return rv;
					}
					goto case Id_namespaceDeclarations;
				}

				case Id_namespaceDeclarations:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "namespaceDeclarations");
					}
					Namespace[] array = xml.NamespaceDeclarations();
					return cx.NewArray(scope, ToObjectArray(array));
				}

				case Id_nodeKind:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "nodeKind");
					}
					return xml.NodeKind();
				}

				case Id_prependChild:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "prependChild");
					}
					return xml.PrependChild(Arg(args, 0));
				}

				case Id_removeNamespace:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "removeNamespace");
					}
					Namespace ns = lib.CastToNamespace(cx, Arg(args, 0));
					return xml.RemoveNamespace(ns);
				}

				case Id_replace:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "replace");
					}
					XMLName xmlName = lib.ToXMLNameOrIndex(cx, Arg(args, 0));
					object arg1 = Arg(args, 1);
					if (xmlName == null)
					{
						//    I refuse to believe that this number will exceed 2^31
						int index = (int)ScriptRuntime.LastUint32Result(cx);
						return xml.Replace(index, arg1);
					}
					else
					{
						return xml.Replace(xmlName, arg1);
					}
					goto case Id_setChildren;
				}

				case Id_setChildren:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "setChildren");
					}
					return xml.SetChildren(Arg(args, 0));
				}

				case Id_setLocalName:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "setLocalName");
					}
					string localName;
					object arg = Arg(args, 0);
					if (arg is QName)
					{
						localName = ((QName)arg).LocalName();
					}
					else
					{
						localName = ScriptRuntime.ToString(arg);
					}
					xml.SetLocalName(localName);
					return Undefined.instance;
				}

				case Id_setName:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "setName");
					}
					object arg = (args.Length != 0) ? args[0] : Undefined.instance;
					QName qname = lib.ConstructQName(cx, arg);
					xml.SetName(qname);
					return Undefined.instance;
				}

				case Id_setNamespace:
				{
					if (xml == null)
					{
						XmlMethodNotFound(realThis, "setNamespace");
					}
					Namespace ns = lib.CastToNamespace(cx, Arg(args, 0));
					xml.SetNamespace(ns);
					return Undefined.instance;
				}

				case Id_attribute:
				{
					XMLName xmlName = XMLName.Create(lib.ToNodeQName(cx, Arg(args, 0), true), true, false);
					return realThis.GetMatches(xmlName);
				}

				case Id_attributes:
				{
					return realThis.GetMatches(XMLName.Create(Rhino.Xmlimpl.XmlNode.QName.Create(null, null), true, false));
				}

				case Id_child:
				{
					XMLName xmlName = lib.ToXMLNameOrIndex(cx, Arg(args, 0));
					if (xmlName == null)
					{
						//    Two billion or so is a fine upper limit, so we cast to int
						int index = (int)ScriptRuntime.LastUint32Result(cx);
						return realThis.Child(index);
					}
					else
					{
						return realThis.Child(xmlName);
					}
					goto case Id_children;
				}

				case Id_children:
				{
					return realThis.Children();
				}

				case Id_comments:
				{
					return realThis.Comments();
				}

				case Id_contains:
				{
					return ScriptRuntime.WrapBoolean(realThis.Contains(Arg(args, 0)));
				}

				case Id_copy:
				{
					return realThis.Copy();
				}

				case Id_descendants:
				{
					Rhino.Xmlimpl.XmlNode.QName qname = (args.Length == 0) ? Rhino.Xmlimpl.XmlNode.QName.Create(null, null) : lib.ToNodeQName(cx, args[0], false);
					return realThis.GetMatches(XMLName.Create(qname, false, true));
				}

				case Id_elements:
				{
					XMLName xmlName = (args.Length == 0) ? XMLName.FormStar() : lib.ToXMLName(cx, args[0]);
					return realThis.Elements(xmlName);
				}

				case Id_hasOwnProperty:
				{
					XMLName xmlName = lib.ToXMLName(cx, Arg(args, 0));
					return ScriptRuntime.WrapBoolean(realThis.HasOwnProperty(xmlName));
				}

				case Id_hasComplexContent:
				{
					return ScriptRuntime.WrapBoolean(realThis.HasComplexContent());
				}

				case Id_hasSimpleContent:
				{
					return ScriptRuntime.WrapBoolean(realThis.HasSimpleContent());
				}

				case Id_length:
				{
					return ScriptRuntime.WrapInt(realThis.Length());
				}

				case Id_normalize:
				{
					realThis.Normalize();
					return Undefined.instance;
				}

				case Id_parent:
				{
					return realThis.Parent();
				}

				case Id_processingInstructions:
				{
					XMLName xmlName = (args.Length > 0) ? lib.ToXMLName(cx, args[0]) : XMLName.FormStar();
					return realThis.ProcessingInstructions(xmlName);
				}

				case Id_propertyIsEnumerable:
				{
					return ScriptRuntime.WrapBoolean(realThis.PropertyIsEnumerable(Arg(args, 0)));
				}

				case Id_text:
				{
					return realThis.Text();
				}

				case Id_toString:
				{
					return realThis.ToString();
				}

				case Id_toSource:
				{
					int indent = ScriptRuntime.ToInt32(args, 0);
					return realThis.ToSource(indent);
				}

				case Id_toXMLString:
				{
					return realThis.ToXMLString();
				}

				case Id_valueOf:
				{
					return realThis.ValueOf();
				}
			}
			throw new ArgumentException(id.ToString());
		}
示例#25
0
		public virtual object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (f.HasTag(FTAG))
			{
				if (f.MethodId() == Id_getClass)
				{
					return Js_getClass(cx, scope, args);
				}
			}
			throw f.Unknown();
		}