Ejemplo n.º 1
0
 public override bool HasOwnProperty(string key)
 {
     if (bag != null)
     {
         return(bag.HasOwnProperty(key));
     }
     else
     {
         return(base.HasOwnProperty(key));
     }
 }
        public virtual bool HasProperty(string key)
        {
            JsDictionaryObject obj = this;

            while (true)
            {
                if (obj.HasOwnProperty(key))
                {
                    return(true);
                }

                obj = obj.Prototype;

                if (obj == JsUndefined.Instance || obj == JsNull.Instance)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 3
0
        public virtual JsInstance GetSetFunction(
            JsDictionaryObject target,
            JsInstance[] parameters)
        {
            if (parameters.Length == 0)
            {
                throw new ArgumentException("propertyName");
            }
            if (!target.HasOwnProperty(parameters[0].ToString()))
            {
                return(this.GetSetFunction(target.Prototype, parameters));
            }
            PropertyDescriptor propertyDescriptor = target.properties.Get(parameters[0].ToString()) as PropertyDescriptor;

            if (propertyDescriptor == null)
            {
                return((JsInstance)JsUndefined.Instance);
            }
            return((JsInstance)((JsObject)propertyDescriptor.SetFunction ?? (JsObject)JsUndefined.Instance));
        }
        /// <summary>
        /// non standard
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="p"></param>
        /// <param name="currentDescriptor"></param>
        public JsInstance GetSetFunction(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (parameters.Length <= 0)
            {
                throw new ArgumentException("propertyName");
            }

            if (!target.HasOwnProperty(parameters[0].ToString()))
            {
                return(GetSetFunction(target.Prototype, parameters));
            }

            PropertyDescriptor desc = target.properties.Get(parameters[0].ToString()) as PropertyDescriptor;

            if (desc == null)
            {
                return(JsUndefined.Instance);
            }

            return((JsInstance)desc.SetFunction ?? JsUndefined.Instance);
        }
Ejemplo n.º 5
0
        public virtual bool HasProperty(string key)
        {
            JsDictionaryObject dictionaryObject = this;

            do
            {
                if (!dictionaryObject.HasOwnProperty(key))
                {
                    dictionaryObject = dictionaryObject.Prototype;
                }
                else
                {
                    goto label_1;
                }
            }while (dictionaryObject != JsUndefined.Instance && dictionaryObject != JsNull.Instance);
            goto label_3;
label_1:
            return(true);

label_3:
            return(false);
        }
Ejemplo n.º 6
0
 // 15.2.4.5
 public JsInstance HasOwnPropertyImpl(JsDictionaryObject target, JsInstance[] parameters)
 {
     return(Global.BooleanClass.New(target.HasOwnProperty(parameters[0])));
 }