Beispiel #1
0
 internal void Reset()
 {
     _fields = null;
     length  = 0;
     a0      = null;
     a1      = null;
     a2      = null;
     a3      = null;
     a4      = null;
     //a5 = null;
     //a6 = null;
     //a7 = null;
     callee           = null;
     caller           = null;
     _objectPrototype = null;
     _lengthContainer = null;
     _valueType       = JSValueType.Object;
     _oValue          = this;
     _attributes      = JSValueAttributesInternal.DoNotDelete | JSValueAttributesInternal.DoNotEnumerate | JSValueAttributesInternal.SystemObject;
 }
Beispiel #2
0
 internal void Reset()
 {
     fields = null;
     length = 0;
     a0 = null;
     a1 = null;
     a2 = null;
     a3 = null;
     a4 = null;
     //a5 = null;
     //a6 = null;
     //a7 = null;
     callee = null;
     caller = null;
     __prototype = null;
     _length = null;
     valueType = JSObjectType.Object;
     oValue = this;
     attributes = JSObjectAttributesInternal.DoNotDelete | JSObjectAttributesInternal.DoNotEnum | JSObjectAttributesInternal.SystemObject;
 }
Beispiel #3
0
        protected internal override JSValue GetProperty(JSValue key, bool forWrite, PropertyScope memberScope)
        {
            if (forWrite)
            {
                cloneValues();
            }

            if (memberScope < PropertyScope.Super && key._valueType != JSValueType.Symbol)
            {
                forWrite &= (_attributes & JSValueAttributesInternal.Immutable) == 0;
                if (key._valueType == JSValueType.Integer)
                {
                    switch (key._iValue)
                    {
                    case 0:
                        return(a0 ?? (!forWrite ? notExists : (a0 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));

                    case 1:
                        return(a1 ?? (!forWrite ? notExists : (a1 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));

                    case 2:
                        return(a2 ?? (!forWrite ? notExists : (a2 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));

                    case 3:
                        return(a3 ?? (!forWrite ? notExists : (a3 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));

                    case 4:
                        return(a4 ?? (!forWrite ? notExists : (a4 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));
                    }
                }
                switch (key.ToString())
                {
                case "0":
                    return(a0 ?? (!forWrite ? notExists : (a0 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "1":
                    return(a1 ?? (!forWrite ? notExists : (a1 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "2":
                    return(a2 ?? (!forWrite ? notExists : (a2 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "3":
                    return(a3 ?? (!forWrite ? notExists : (a3 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "4":
                    return(a4 ?? (!forWrite ? notExists : (a4 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "length":
                {
                    if (_lengthContainer == null)
                    {
                        _lengthContainer = new _LengthContainer(this)
                        {
                            _valueType  = JSValueType.Integer,
                            _iValue     = length,
                            _attributes = JSValueAttributesInternal.DoNotEnumerate | JSValueAttributesInternal.Reassign
                        }
                    }
                    ;
                    return(_lengthContainer);
                }

                case "callee":
                {
                    if (callee == null)
                    {
                        callee = NotExistsInObject;
                    }

                    if (forWrite && (callee._attributes & JSValueAttributesInternal.SystemObject) != 0)
                    {
                        callee             = callee.CloneImpl(false);
                        callee._attributes = JSValueAttributesInternal.DoNotEnumerate;
                    }
                    return(callee);
                }

                case "caller":
                {
                    if (caller == null)
                    {
                        caller = NotExistsInObject;
                    }

                    if (forWrite && (caller._attributes & JSValueAttributesInternal.SystemObject) != 0)
                    {
                        caller             = caller.CloneImpl(false);
                        callee._attributes = JSValueAttributesInternal.DoNotEnumerate;
                    }
                    return(caller);
                }
                }
            }

            return(base.GetProperty(key, forWrite, memberScope));
        }
Beispiel #4
0
 protected internal override JSObject GetMember(JSObject name, bool createMember, bool own)
 {
     createMember &= (attributes & JSObjectAttributesInternal.Immutable) == 0;
     if (name.valueType == JSObjectType.Int)
     {
         switch (name.iValue)
         {
             case 0:
                 return (a0 ?? (!createMember ? notExists : (a0 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             case 1:
                 return (a1 ?? (!createMember ? notExists : (a1 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             case 2:
                 return (a2 ?? (!createMember ? notExists : (a2 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             case 3:
                 return (a3 ?? (!createMember ? notExists : (a3 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             case 4:
                 return (a4 ?? (!createMember ? notExists : (a4 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             //case 5:
             //    return (a5 ?? (!createMember ? notExists : (a5 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             //case 6:
             //    return (a6 ?? (!createMember ? notExists : (a6 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             //case 7:
             //    return (a7 ?? (!createMember ? notExists : (a7 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         }
     }
     switch (name.ToString())
     {
         case "0":
             return (a0 ?? (!createMember ? notExists : (a0 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         case "1":
             return (a1 ?? (!createMember ? notExists : (a1 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         case "2":
             return (a2 ?? (!createMember ? notExists : (a2 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         case "3":
             return (a3 ?? (!createMember ? notExists : (a3 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         case "4":
             return (a4 ?? (!createMember ? notExists : (a4 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         //case "5":
         //    return (a5 ?? (!createMember ? notExists : (a5 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         //case "6":
         //    return (a6 ?? (!createMember ? notExists : (a6 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         //case "7":
         //    return (a7 ?? (!createMember ? notExists : (a7 = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
         case "length":
             {
                 if (_length == null)
                     _length = new _LengthContainer(this) { valueType = JSObjectType.Int, iValue = length, attributes = JSObjectAttributesInternal.DoNotEnum | JSObjectAttributesInternal.Reassign };
                 return _length;
             }
         case "callee":
             {
                 if (createMember && (callee.attributes & JSObjectAttributesInternal.SystemObject) != 0)
                 {
                     callee = callee.CloneImpl();
                     callee.attributes = JSObjectAttributesInternal.DoNotEnum;
                 }
                 return (callee ?? (!createMember ? notExists : (callee = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             }
         case "caller":
             {
                 if (createMember && (caller.attributes & JSObjectAttributesInternal.SystemObject) != 0)
                 {
                     caller = caller.CloneImpl();
                     callee.attributes = JSObjectAttributesInternal.DoNotEnum;
                 }
                 return (caller ?? (!createMember ? notExists : (caller = new JSObject() { valueType = JSObjectType.NotExistsInObject })));
             }
     }
     return base.GetMember(name, createMember, own);
 }