示例#1
0
        public override void InitPrototype(IGlobal global)
        {
            Prototype = new JsObject() { Prototype = global.FunctionClass.Prototype };

            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
        }
示例#2
0
        public override void InitPrototype(IGlobal global)
        {
            JsObject prototypeProperty = this.PrototypeProperty;

            prototypeProperty.DefineOwnProperty("toString", (JsInstance)global.FunctionClass.New <JsInstance>(new Func <JsInstance, JsInstance[], JsInstance>(this.ToStringImpl), 1), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleString", (JsInstance)global.FunctionClass.New <JsInstance>(new Func <JsInstance, JsInstance[], JsInstance>(this.ToLocaleStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toFixed", (JsInstance)global.FunctionClass.New <JsInstance>(new Func <JsInstance, JsInstance[], JsInstance>(this.ToFixedImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toExponential", (JsInstance)global.FunctionClass.New <JsInstance>(new Func <JsInstance, JsInstance[], JsInstance>(this.ToExponentialImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toPrecision", (JsInstance)global.FunctionClass.New <JsInstance>(new Func <JsInstance, JsInstance[], JsInstance>(this.ToPrecisionImpl)), PropertyAttributes.DontEnum);
        }
示例#3
0
        public override void InitPrototype(IGlobal global)
        {
            Prototype = new JsObject()
            {
                Prototype = global.FunctionClass.Prototype
            };

            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("toString", global.FunctionClass.New <JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New <JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
        }
示例#4
0
        /// <summary>
        /// Creates new JsObject, sets a [[Prototype]] to the Prototype parameter and a 'constructor' property to the specified function.
        /// </summary>
        /// <param name="constructor">JsFunction which is used as a constructor</param>
        /// <param name="Prototype">JsObjetc which is used as a prototype</param>
        /// <returns>new object</returns>
        public JsObject New(JsFunction constructor, JsObject Prototype)
        {
            JsObject obj = new JsObject(Prototype);

            obj.DefineOwnProperty(new ValueDescriptor(obj, CONSTRUCTOR, constructor)
            {
                Enumerable = false
            });
            return(obj);
        }
示例#5
0
        public JsObject New(JsFunction constructor, JsObject Prototype)
        {
            JsObject        jsObject1       = new JsObject(Prototype);
            JsObject        jsObject2       = jsObject1;
            ValueDescriptor valueDescriptor = new ValueDescriptor((JsDictionaryObject)jsObject1, JsFunction.CONSTRUCTOR, (JsInstance)constructor);

            valueDescriptor.Enumerable = false;
            jsObject2.DefineOwnProperty((Descriptor)valueDescriptor);
            return(jsObject1);
        }
        public JsApplyFunction(JsFunctionConstructor constructor)
        {
            if (constructor != null)
            {
                Prototype = new JsObject()
                {
                    Prototype = constructor.Prototype
                }
            }
            ;

            Prototype.DefineOwnProperty("length", new ValueDescriptor(Prototype, "length", constructor.Global.NumberClass.New(2))
            {
                Writable = false
            });
        }
示例#7
0
        public override void InitPrototype(IGlobal global)
        {
            JsObject prototypeProperty = this.PrototypeProperty;

            prototypeProperty.DefineOwnProperty("constructor", (JsInstance)this, PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty(JsFunction.CALL.ToString(), (JsInstance) new JsCallFunction(this), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty(JsFunction.APPLY.ToString(), (JsInstance) new JsApplyFunction(this), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toString", (JsInstance)this.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToString2)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleString", (JsInstance)this.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToString2)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty((Descriptor) new PropertyDescriptor <JsObject>(global, (JsDictionaryObject)prototypeProperty, "length", new Func <JsObject, JsInstance>(this.GetLengthImpl), new Func <JsObject, JsInstance[], JsInstance>(this.SetLengthImpl)));
        }
示例#8
0
        public override void InitPrototype(IGlobal global)
        {
            JsObject prototypeProperty = this.PrototypeProperty;
            JsObject jsObject          = prototypeProperty;
            PropertyDescriptor <JsObject> propertyDescriptor = new PropertyDescriptor <JsObject>(global, (JsDictionaryObject)prototypeProperty, "length", new Func <JsObject, JsInstance>(this.GetLengthImpl), new Func <JsObject, JsInstance[], JsInstance>(this.SetLengthImpl));

            propertyDescriptor.Enumerable = false;
            jsObject.DefineOwnProperty((Descriptor)propertyDescriptor);
            prototypeProperty.DefineOwnProperty("toString", (JsInstance)global.FunctionClass.New <JsArray>(new Func <JsArray, JsInstance[], JsInstance>(this.ToStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleString", (JsInstance)global.FunctionClass.New <JsArray>(new Func <JsArray, JsInstance[], JsInstance>(this.ToLocaleStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("concat", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Concat)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("join", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Join), 1), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("pop", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Pop)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("push", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Push), 1), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("reverse", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Reverse)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("shift", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Shift)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("slice", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Slice), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("sort", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Sort)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("splice", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.Splice), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("unshift", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.UnShift), 1), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("indexOf", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.IndexOfImpl), 1), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("lastIndexOf", (JsInstance)global.FunctionClass.New <JsObject>(new Func <JsObject, JsInstance[], JsInstance>(this.LastIndexOfImpl), 1), PropertyAttributes.DontEnum);
        }
示例#9
0
 /// <summary>
 /// Creates new JsObject, sets a [[Prototype]] to the Prototype parameter and a 'constructor' property to the specified function.
 /// </summary>
 /// <param name="constructor">JsFunction which is used as a constructor</param>
 /// <param name="Prototype">JsObjetc which is used as a prototype</param>
 /// <returns>new object</returns>
 public JsObject New(JsFunction constructor, JsObject Prototype)
 {
     JsObject obj = new JsObject(Prototype);
     obj.DefineOwnProperty(new ValueDescriptor(obj, CONSTRUCTOR, constructor) { Enumerable = false });
     return obj;
 }
        public override void InitPrototype(IGlobal global)
        {
            Prototype = new JsObject()
            {
                Prototype = global.FunctionClass.Prototype
            };
            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            #region Methods
            Prototype.DefineOwnProperty("toString", global.FunctionClass.New <JsArray>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New <JsArray>(ToLocaleStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("concat", global.FunctionClass.New <JsObject>(Concat), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("join", global.FunctionClass.New <JsObject>(Join, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("pop", global.FunctionClass.New <JsObject>(Pop), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("push", global.FunctionClass.New <JsObject>(Push, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("reverse", global.FunctionClass.New <JsObject>(Reverse), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("shift", global.FunctionClass.New <JsObject>(Shift), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("slice", global.FunctionClass.New <JsObject>(Slice, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("sort", global.FunctionClass.New <JsObject>(Sort), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("splice", global.FunctionClass.New <JsObject>(Splice, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("unshift", global.FunctionClass.New <JsObject>(UnShift, 1), PropertyAttributes.DontEnum);

            #region ES5
            Prototype.DefineOwnProperty("indexOf", global.FunctionClass.New <JsObject>(IndexOfImpl, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("lastIndexOf", global.FunctionClass.New <JsObject>(LastIndexOfImpl, 1), PropertyAttributes.DontEnum);
            #endregion

            #endregion

            #region Properties
            Prototype.DefineOwnProperty("length", new PropertyDescriptor <JsObject>(global, Prototype, "length", GetLengthImpl, SetLengthImpl));
            #endregion
        }
示例#11
0
        public override void InitPrototype(IGlobal global)
        {
            JsObject prototypeProperty = this.PrototypeProperty;

            prototypeProperty.DefineOwnProperty("split", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SplitImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("replace", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ReplaceImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("match", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.MatchFunc)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("localeCompare", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.LocaleCompareImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("substring", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SubstringImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("substr", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SubstrImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("search", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SearchImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("valueOf", (JsInstance)global.FunctionClass.New <JsString>(new Func <JsString, JsInstance[], JsInstance>(this.ValueOfImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("concat", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ConcatImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("charAt", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.CharAtImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("charCodeAt", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.CharCodeAtImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("lastIndexOf", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.LastIndexOfImpl), 1), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("indexOf", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.IndexOfImpl), 1), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLowerCase", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToLowerCaseImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleLowerCase", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToLocaleLowerCaseImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toUpperCase", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToUpperCaseImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleUpperCase", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToLocaleUpperCaseImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("slice", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SliceImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty((Descriptor) new PropertyDescriptor <JsDictionaryObject>(global, (JsDictionaryObject)prototypeProperty, "length", new Func <JsDictionaryObject, JsInstance>(this.LengthImpl)));
        }
示例#12
0
        public override void InitPrototype(IGlobal global)
        {
            Prototype = new JsObject() { Prototype = global.FunctionClass.Prototype };
            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            #region Methods
            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsArray>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsArray>(ToLocaleStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("concat", global.FunctionClass.New<JsObject>(Concat), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("join", global.FunctionClass.New<JsObject>(Join, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("pop", global.FunctionClass.New<JsObject>(Pop), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("push", global.FunctionClass.New<JsObject>(Push, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("reverse", global.FunctionClass.New<JsObject>(Reverse), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("shift", global.FunctionClass.New<JsObject>(Shift), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("slice", global.FunctionClass.New<JsObject>(Slice, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("sort", global.FunctionClass.New<JsObject>(Sort), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("splice", global.FunctionClass.New<JsObject>(Splice, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("unshift", global.FunctionClass.New<JsObject>(UnShift, 1), PropertyAttributes.DontEnum);

            #region ES5
            Prototype.DefineOwnProperty("indexOf", global.FunctionClass.New<JsObject>(IndexOfImpl, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("lastIndexOf", global.FunctionClass.New<JsObject>(LastIndexOfImpl, 1), PropertyAttributes.DontEnum);
            #endregion

            #endregion
        }
示例#13
0
        public override void InitPrototype(IGlobal global)
        {
            JsObject prototypeProperty = this.PrototypeProperty;

            prototypeProperty.DefineOwnProperty("UTC", (JsInstance) new JsFunctionWrapper(new Func <JsInstance[], JsInstance>(this.UTCImpl), global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("now", (JsInstance) new ClrFunction((Delegate)(() => this.Global.DateClass.New(DateTime.Now)), global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("parse", (JsInstance) new JsFunctionWrapper(new Func <JsInstance[], JsInstance>(this.ParseImpl), global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("parseLocale", (JsInstance) new JsFunctionWrapper(new Func <JsInstance[], JsInstance>(this.ParseLocaleImpl), global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toDateString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToDateStringImpl), 0), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toTimeString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToTimeStringImpl), 0), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToLocaleStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleDateString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToLocaleDateStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleTimeString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToLocaleTimeStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("valueOf", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ValueOfImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getTime", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetTimeImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getFullYear", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetFullYearImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getUTCFullYear", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetUTCFullYearImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getMonth", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetMonthImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getUTCMonth", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetUTCMonthImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getDate", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetDateImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getUTCDate", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetUTCDateImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getDay", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetDayImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getUTCDay", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetUTCDayImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getHours", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetHoursImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getUTCHours", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetUTCHoursImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getMinutes", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetMinutesImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getUTCMinutes", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetUTCMinutesImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getSeconds", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetSecondsImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getUTCSeconds", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetUTCSecondsImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getMilliseconds", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetMillisecondsImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getUTCMilliseconds", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetUTCMillisecondsImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getTimezoneOffset", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.GetTimezoneOffsetImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setTime", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetTimeImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setMilliseconds", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetMillisecondsImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setUTCMilliseconds", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetUTCMillisecondsImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setSeconds", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetSecondsImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setUTCSeconds", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetUTCSecondsImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setMinutes", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetMinutesImpl), 3), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setUTCMinutes", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetUTCMinutesImpl), 3), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setHours", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetHoursImpl), 4), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setUTCHours", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetUTCHoursImpl), 4), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setDate", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetDateImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setUTCDate", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetUTCDateImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setMonth", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetMonthImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setUTCMonth", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetUTCMonthImpl), 2), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setFullYear", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetFullYearImpl), 3), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("setUTCFullYear", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.SetUTCFullYearImpl), 3), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toUTCString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToUTCStringImpl)), PropertyAttributes.DontEnum);
        }
示例#14
0
        public override void InitPrototype(IGlobal global)
        {
            JsObject prototypeProperty = this.PrototypeProperty;

            prototypeProperty.DefineOwnProperty("constructor", (JsInstance)this, PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("toLocaleString", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ToStringImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("valueOf", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.ValueOfImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("hasOwnProperty", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.HasOwnPropertyImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("isPrototypeOf", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.IsPrototypeOfImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("propertyIsEnumerable", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(this.PropertyIsEnumerableImpl)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("getPrototypeOf", (JsInstance) new JsFunctionWrapper(new Func <JsInstance[], JsInstance>(this.GetPrototypeOfImpl), global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            if (!global.HasOption(Options.Ecmascript5))
            {
                return;
            }
            prototypeProperty.DefineOwnProperty("defineProperty", (JsInstance) new JsFunctionWrapper(new Func <JsInstance[], JsInstance>(this.DefineProperty), global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("__lookupGetter__", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(((JsDictionaryObject)this).GetGetFunction)), PropertyAttributes.DontEnum);
            prototypeProperty.DefineOwnProperty("__lookupSetter__", (JsInstance)global.FunctionClass.New <JsDictionaryObject>(new Func <JsDictionaryObject, JsInstance[], JsInstance>(((JsDictionaryObject)this).GetSetFunction)), PropertyAttributes.DontEnum);
        }