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);
}
Aggregations