1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using Jint.Runtime;
- using Jint.Runtime.Interop;
- namespace Jint.Native.Number
- {
- /// <summary>
- /// http://www.ecma-international.org/ecma-262/5.1/#sec-15.7.4
- /// </summary>
- public sealed class NumberPrototype : NumberInstance
- {
- private NumberPrototype(Engine engine)
- : base(engine)
- {
- }
- public static NumberPrototype CreatePrototypeObject(Engine engine, NumberConstructor numberConstructor)
- {
- var obj = new NumberPrototype(engine);
- obj.Prototype = engine.Object.PrototypeObject;
- obj.PrimitiveValue = 0;
- obj.FastAddProperty("constructor", numberConstructor, false, false, false);
- return obj;
- }
- public void Configure()
- {
- FastAddProperty("toString", new ClrFunctionInstance<object, object>(Engine, ToNumberString), false, false, false);
- FastAddProperty("toLocaleString", new ClrFunctionInstance<object, object>(Engine, ToLocaleString), false, false, false);
- FastAddProperty("valueOf", new ClrFunctionInstance<object, object>(Engine, ValueOf), false, false, false);
- FastAddProperty("toFixed", new ClrFunctionInstance<object, object>(Engine, ToFixed), false, false, false);
- FastAddProperty("toExponential", new ClrFunctionInstance<object, object>(Engine, ToExponential), false, false, false);
- FastAddProperty("toPrecision", new ClrFunctionInstance<object, object>(Engine, ToPrecision), false, false, false);
- }
- private object ToLocaleString(object thisObj, object[] arguments)
- {
- throw new System.NotImplementedException();
- }
- private object ValueOf(object thisObj, object[] arguments)
- {
- throw new System.NotImplementedException();
- }
- private object ToFixed(object thisObj, object[] arguments)
- {
- throw new System.NotImplementedException();
- }
- private object ToExponential(object thisObj, object[] arguments)
- {
- throw new System.NotImplementedException();
- }
- private object ToPrecision(object thisObj, object[] arguments)
- {
- throw new System.NotImplementedException();
- }
- private static object ToNumberString(object thisObject, object[] arguments)
- {
- return TypeConverter.ToString(thisObject);
- }
- }
- }
|