Search in sources :

Example 1 with TypeErrorThrower

use of com.github.anba.es6draft.runtime.types.builtins.TypeErrorThrower 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)

Aggregations

AsyncFunctionConstructor (com.github.anba.es6draft.runtime.objects.async.AsyncFunctionConstructor)1 AsyncFunctionPrototype (com.github.anba.es6draft.runtime.objects.async.AsyncFunctionPrototype)1 AsyncGeneratorFunctionConstructor (com.github.anba.es6draft.runtime.objects.async.iteration.AsyncGeneratorFunctionConstructor)1 AsyncGeneratorFunctionPrototype (com.github.anba.es6draft.runtime.objects.async.iteration.AsyncGeneratorFunctionPrototype)1 AtomicsObject (com.github.anba.es6draft.runtime.objects.atomics.AtomicsObject)1 IntlObject (com.github.anba.es6draft.runtime.objects.intl.IntlObject)1 GeneratorFunctionConstructor (com.github.anba.es6draft.runtime.objects.iteration.GeneratorFunctionConstructor)1 GeneratorFunctionPrototype (com.github.anba.es6draft.runtime.objects.iteration.GeneratorFunctionPrototype)1 MathObject (com.github.anba.es6draft.runtime.objects.number.MathObject)1 RealmObject (com.github.anba.es6draft.runtime.objects.reflect.RealmObject)1 ReflectObject (com.github.anba.es6draft.runtime.objects.reflect.ReflectObject)1 SystemObject (com.github.anba.es6draft.runtime.objects.reflect.SystemObject)1 Intrinsics (com.github.anba.es6draft.runtime.types.Intrinsics)1 ScriptObject (com.github.anba.es6draft.runtime.types.ScriptObject)1 ArrayObject (com.github.anba.es6draft.runtime.types.builtins.ArrayObject)1 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)1 TypeErrorThrower (com.github.anba.es6draft.runtime.types.builtins.TypeErrorThrower)1