Search in sources :

Example 56 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class Properties method createValue.

private static void createValue(Realm realm, OrdinaryObject target, ValueLayout layout) {
    Object value = resolveValue(realm, layout.rawValue);
    defineProperty(target, layout, valueProperty(layout, value));
}
Also used : ScriptObject(com.github.anba.es6draft.runtime.types.ScriptObject) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)

Example 57 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class Realm method initializeReflectModule.

/**
     * <h1>26 Reflection</h1>
     * 
     * @param realm
     *            the realm instance
     */
private static void initializeReflectModule(Realm realm) {
    EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
    // allocation phase
    ProxyConstructor proxy = new ProxyConstructor(realm);
    ReflectObject reflect = new ReflectObject(realm);
    // registration phase
    intrinsics.put(Intrinsics.Proxy, proxy);
    intrinsics.put(Intrinsics.Reflect, reflect);
    // initialization phase
    proxy.initialize(realm);
    if (realm.isEnabled(CompatibilityOption.Realm)) {
        RealmConstructor realmConstructor = new RealmConstructor(realm);
        RealmPrototype realmPrototype = new RealmPrototype(realm);
        intrinsics.put(Intrinsics.Realm, realmConstructor);
        intrinsics.put(Intrinsics.RealmPrototype, realmPrototype);
        realmConstructor.initialize(realm);
        realmPrototype.initialize(realm);
    }
    if (realm.isEnabled(CompatibilityOption.Loader)) {
        LoaderConstructor loaderConstructor = new LoaderConstructor(realm);
        LoaderPrototype loaderPrototype = new LoaderPrototype(realm);
        intrinsics.put(Intrinsics.Loader, loaderConstructor);
        intrinsics.put(Intrinsics.LoaderPrototype, loaderPrototype);
        loaderConstructor.initialize(realm);
        loaderPrototype.initialize(realm);
    }
    if (realm.isEnabled(CompatibilityOption.System) || realm.isEnabled(CompatibilityOption.SystemGlobal)) {
        SystemObject systemObject = new SystemObject(realm);
        intrinsics.put(Intrinsics.System, systemObject);
        systemObject.initialize(realm);
    }
    reflect.initialize(realm);
}
Also used : RealmConstructor(com.github.anba.es6draft.runtime.objects.reflect.RealmConstructor) Intrinsics(com.github.anba.es6draft.runtime.types.Intrinsics) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) LoaderPrototype(com.github.anba.es6draft.runtime.objects.reflect.LoaderPrototype) ReflectObject(com.github.anba.es6draft.runtime.objects.reflect.ReflectObject) SystemObject(com.github.anba.es6draft.runtime.objects.reflect.SystemObject) LoaderConstructor(com.github.anba.es6draft.runtime.objects.reflect.LoaderConstructor) RealmPrototype(com.github.anba.es6draft.runtime.objects.reflect.RealmPrototype) ProxyConstructor(com.github.anba.es6draft.runtime.objects.reflect.ProxyConstructor)

Example 58 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class Realm method initializeObservableModule.

/**
     * <h1>Extension: Observable</h1>
     * 
     * @param realm
     *            the realm instance
     */
private static void initializeObservableModule(Realm realm) {
    EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
    // allocation phase
    ObservableConstructor observableConstructor = new ObservableConstructor(realm);
    ObservablePrototype observablePrototype = new ObservablePrototype(realm);
    SubscriptionPrototype subscriptionPrototype = new SubscriptionPrototype(realm);
    SubscriptionObserverPrototype subscriptionObserverPrototype = new SubscriptionObserverPrototype(realm);
    // registration phase
    intrinsics.put(Intrinsics.Observable, observableConstructor);
    intrinsics.put(Intrinsics.ObservablePrototype, observablePrototype);
    intrinsics.put(Intrinsics.SubscriptionPrototype, subscriptionPrototype);
    intrinsics.put(Intrinsics.SubscriptionObserverPrototype, subscriptionObserverPrototype);
    // initialization phase
    observableConstructor.initialize(realm);
    observablePrototype.initialize(realm);
    subscriptionPrototype.initialize(realm);
    subscriptionObserverPrototype.initialize(realm);
}
Also used : SubscriptionObserverPrototype(com.github.anba.es6draft.runtime.objects.observable.SubscriptionObserverPrototype) ObservableConstructor(com.github.anba.es6draft.runtime.objects.observable.ObservableConstructor) Intrinsics(com.github.anba.es6draft.runtime.types.Intrinsics) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) SubscriptionPrototype(com.github.anba.es6draft.runtime.objects.observable.SubscriptionPrototype) ObservablePrototype(com.github.anba.es6draft.runtime.objects.observable.ObservablePrototype)

Example 59 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class Realm method initializeFundamentalObjects.

/**
     * <h1>19.1 Object Objects - 19.2 Function Objects</h1>
     * 
     * Fundamental built-in objects which must be initialized early
     * 
     * @param realm
     *            the realm instance
     */
private static void initializeFundamentalObjects(Realm realm) {
    EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
    // allocation phase
    ObjectConstructor objectConstructor = new ObjectConstructor(realm);
    ObjectPrototype objectPrototype = new ObjectPrototype(realm);
    FunctionConstructor functionConstructor = new FunctionConstructor(realm);
    FunctionPrototype functionPrototype = new FunctionPrototype(realm);
    // registration phase
    intrinsics.put(Intrinsics.Object, objectConstructor);
    intrinsics.put(Intrinsics.ObjectPrototype, objectPrototype);
    intrinsics.put(Intrinsics.Function, functionConstructor);
    intrinsics.put(Intrinsics.FunctionPrototype, functionPrototype);
    // Create [[ThrowTypeError]] function before initializing intrinsics.
    realm.throwTypeError = new TypeErrorThrower(realm);
    // Also stored in intrinsics table.
    intrinsics.put(Intrinsics.ThrowTypeError, realm.throwTypeError);
    // initialization phase
    objectConstructor.initialize(realm);
    objectPrototype.initialize(realm);
    functionConstructor.initialize(realm);
    functionPrototype.initialize(realm);
    AddRestrictedFunctionProperties(functionPrototype, realm);
    // Object.prototype.toString is also an intrinsic
    Object objectPrototypeToString = objectPrototype.lookupOwnProperty("toString").getValue();
    intrinsics.put(Intrinsics.ObjProto_toString, (OrdinaryObject) objectPrototypeToString);
}
Also used : AsyncFunctionPrototype(com.github.anba.es6draft.runtime.objects.async.AsyncFunctionPrototype) GeneratorFunctionPrototype(com.github.anba.es6draft.runtime.objects.iteration.GeneratorFunctionPrototype) AsyncGeneratorFunctionPrototype(com.github.anba.es6draft.runtime.objects.async.iteration.AsyncGeneratorFunctionPrototype) Intrinsics(com.github.anba.es6draft.runtime.types.Intrinsics) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ScriptObject(com.github.anba.es6draft.runtime.types.ScriptObject) SystemObject(com.github.anba.es6draft.runtime.objects.reflect.SystemObject) AtomicsObject(com.github.anba.es6draft.runtime.objects.atomics.AtomicsObject) MathObject(com.github.anba.es6draft.runtime.objects.number.MathObject) ReflectObject(com.github.anba.es6draft.runtime.objects.reflect.ReflectObject) IntlObject(com.github.anba.es6draft.runtime.objects.intl.IntlObject) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) ArrayObject(com.github.anba.es6draft.runtime.types.builtins.ArrayObject) RealmObject(com.github.anba.es6draft.runtime.objects.reflect.RealmObject) AsyncGeneratorFunctionConstructor(com.github.anba.es6draft.runtime.objects.async.iteration.AsyncGeneratorFunctionConstructor) GeneratorFunctionConstructor(com.github.anba.es6draft.runtime.objects.iteration.GeneratorFunctionConstructor) AsyncFunctionConstructor(com.github.anba.es6draft.runtime.objects.async.AsyncFunctionConstructor) TypeErrorThrower(com.github.anba.es6draft.runtime.types.builtins.TypeErrorThrower)

Example 60 with OrdinaryObject

use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.

the class Realm method initializePromiseObjects.

/**
     * <h1>25 Control Abstraction Objects</h1><br>
     * <h2>25.4 Promise Objects</h2>
     * 
     * @param realm
     *            the realm instance
     */
private static void initializePromiseObjects(Realm realm) {
    EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
    // allocation phase
    PromiseConstructor promiseConstructor = new PromiseConstructor(realm);
    PromisePrototype promisePrototype = new PromisePrototype(realm);
    // registration phase
    intrinsics.put(Intrinsics.Promise, promiseConstructor);
    intrinsics.put(Intrinsics.PromisePrototype, promisePrototype);
    // initialization phase
    promiseConstructor.initialize(realm);
    promisePrototype.initialize(realm);
}
Also used : PromiseConstructor(com.github.anba.es6draft.runtime.objects.promise.PromiseConstructor) PromisePrototype(com.github.anba.es6draft.runtime.objects.promise.PromisePrototype) Intrinsics(com.github.anba.es6draft.runtime.types.Intrinsics) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)

Aggregations

OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)141 ArrayObject (com.github.anba.es6draft.runtime.types.builtins.ArrayObject)102 ScriptObject (com.github.anba.es6draft.runtime.types.ScriptObject)98 RegExpObject (com.github.anba.es6draft.runtime.objects.text.RegExpObject)84 Intrinsics (com.github.anba.es6draft.runtime.types.Intrinsics)14 Property (com.github.anba.es6draft.runtime.types.Property)5 CompilationException (com.github.anba.es6draft.compiler.CompilationException)3 ParserException (com.github.anba.es6draft.parser.ParserException)3 GlobalEnvironmentRecord (com.github.anba.es6draft.runtime.GlobalEnvironmentRecord)3 RuntimeInfo (com.github.anba.es6draft.runtime.internal.RuntimeInfo)3 ScriptLoader (com.github.anba.es6draft.runtime.internal.ScriptLoader)3 Source (com.github.anba.es6draft.runtime.internal.Source)3 FunctionConstructor.functionSource (com.github.anba.es6draft.runtime.objects.FunctionConstructor.functionSource)3 AsyncGeneratorFunctionConstructor (com.github.anba.es6draft.runtime.objects.async.iteration.AsyncGeneratorFunctionConstructor)3 AsyncGeneratorFunctionPrototype (com.github.anba.es6draft.runtime.objects.async.iteration.AsyncGeneratorFunctionPrototype)3 AtomicsObject (com.github.anba.es6draft.runtime.objects.atomics.AtomicsObject)3 IntlObject (com.github.anba.es6draft.runtime.objects.intl.IntlObject)3 ArrayList (java.util.ArrayList)3 MethodCode (com.github.anba.es6draft.compiler.assembler.Code.MethodCode)2 MethodName (com.github.anba.es6draft.compiler.assembler.MethodName)2