Search in sources :

Example 1 with WeakRefPrototype

use of com.github.anba.es6draft.runtime.objects.reflect.WeakRefPrototype 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.getRuntimeContext().isEnabled(CompatibilityOption.Realm) || realm.getRuntimeContext().isEnabled(CompatibilityOption.FrozenRealm)) {
        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.getRuntimeContext().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.getRuntimeContext().isEnabled(CompatibilityOption.WeakReference)) {
        WeakRefPrototype weakReferencePrototype = new WeakRefPrototype(realm);
        intrinsics.put(Intrinsics.WeakRefPrototype, weakReferencePrototype);
        weakReferencePrototype.initialize(realm);
    }
    if (realm.getRuntimeContext().isEnabled(CompatibilityOption.System) || realm.getRuntimeContext().isEnabled(CompatibilityOption.SystemGlobal) || realm.getRuntimeContext().isEnabled(CompatibilityOption.WeakReference) || realm.getRuntimeContext().isEnabled(CompatibilityOption.ErrorStacks)) {
        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) WeakRefPrototype(com.github.anba.es6draft.runtime.objects.reflect.WeakRefPrototype) 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)

Aggregations

LoaderConstructor (com.github.anba.es6draft.runtime.objects.reflect.LoaderConstructor)1 LoaderPrototype (com.github.anba.es6draft.runtime.objects.reflect.LoaderPrototype)1 ProxyConstructor (com.github.anba.es6draft.runtime.objects.reflect.ProxyConstructor)1 RealmConstructor (com.github.anba.es6draft.runtime.objects.reflect.RealmConstructor)1 RealmPrototype (com.github.anba.es6draft.runtime.objects.reflect.RealmPrototype)1 ReflectObject (com.github.anba.es6draft.runtime.objects.reflect.ReflectObject)1 SystemObject (com.github.anba.es6draft.runtime.objects.reflect.SystemObject)1 WeakRefPrototype (com.github.anba.es6draft.runtime.objects.reflect.WeakRefPrototype)1 Intrinsics (com.github.anba.es6draft.runtime.types.Intrinsics)1 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)1