Exemple #1
0
        public JSObject()
        {
            elems          = new Hashtable();
            property_cache = new Hashtable();

            /* Initialize cache for common properties if this is a Prototype */
            Type type = this.GetType();

            if (type.GetField("Proto", BindingFlags.NonPublic | BindingFlags.Static) != null)
            {
                foreach (MemberInfo field in type.GetMembers())
                {
                    if (field.DeclaringType != type)
                    {
                        continue;
                    }

                    string name = field.Name;
                    if (name.StartsWith("get_"))
                    {
                        name = name.Substring(4);
                    }
                    if (name == "Item" || name.StartsWith("set_") || name.StartsWith("."))
                    {
                        continue;
                    }

                    property_cache [LateBinding.MapToExternalName(name)] = this;
                }
            }
        }