public virtual Descriptor GetDescriptor(string index) { Descriptor result; if (properties.TryGet(index, out result)) { return(result); } // Prototype always a JsObject, (JsNull.Instance is also an object and next call will return null in case of null) if ((result = Prototype.GetDescriptor(index)) != null) { properties.Put(index, result); // cache descriptior } return(result); }
public virtual JsInstance this[string index] { get { Descriptor d = GetDescriptor(index); return(d != null?d.Get(this) : JsUndefined.Instance); } set { Descriptor d = GetDescriptor(index); if (d == null || (d.DescriptorType == DescriptorType.Value && d.Owner != this)) { bool enumerable = index != PROTOTYPE; if (index == PROTOTYPE) { prototypeDescriptor.Set(this, value); } else { if (d == null) { properties.Put(index, new ValueDescriptor(this, index, value) { Enumerable = enumerable }); } else { d.Set(this, value); } } } else { d.Set(this, value); } } }
public Jint.Native.Descriptor Put(string name, Jint.Native.Descriptor descriptor) { bag.Put(name, descriptor); return(lastAccessed = descriptor); }