Example #1
0
        protected override RuntimeObject CreateObject()
        {
            RuntimeFunction constructor = this.constructor ?? new DelegateRuntimeFunction(name, extends != null ? defaultInheritedConstructor : defaultEmptyConstructor);

            constructor.AsDerivedClassConstructorOf(extends != null ? extends.Target.ToObject() : null);
            if (name != null)
            {
                constructor.DefinePropertyOrThrow(WellKnownProperty.Name, new EcmaPropertyDescriptor(name, EcmaPropertyAttributes.Configurable));
            }
            if (staticProperties != null)
            {
                DefineProperties(constructor, staticProperties);
            }
            if (properties != null)
            {
                DefineProperties(constructor.Prototype, properties);
            }
            return(constructor);
        }