use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.
the class JSONParser method jsonObject.
/**
* <pre>
* JSONObject :
* { }
* { JSONMemberList }
* JSONMemberList :
* JSONMember
* JSONMemberList , JSONMember
* JSONMember :
* JSONString : JSONValue
* </pre>
*
* @return the script object represented by the JSON object
*/
private OrdinaryObject jsonObject() {
OrdinaryObject object = ObjectCreate(cx, Intrinsics.ObjectPrototype);
consume(Token.LC);
if (token() != Token.RC) {
for (; ; ) {
consume(Token.STRING);
String name = ts.getString();
consume(Token.COLON);
Object value = jsonValue();
object.defineOwnProperty(cx, name, new PropertyDescriptor(value, true, true, true));
if (token() == Token.RC) {
break;
}
consume(Token.COMMA);
}
}
consume(Token.RC);
return object;
}
use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.
the class Realm method initializeBinaryModule.
/**
* <h1>22.2 TypedArray Objects, 24.1 ArrayBuffer Objects, 24.2 DataView Objects</h1>
*
* @param realm
* the realm instance
*/
private static void initializeBinaryModule(Realm realm) {
EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
// allocation phase
ArrayBufferConstructor arrayBufferConstructor = new ArrayBufferConstructor(realm);
ArrayBufferPrototype arrayBufferPrototype = new ArrayBufferPrototype(realm);
TypedArrayConstructorPrototype typedArrayConstructor = new TypedArrayConstructorPrototype(realm);
TypedArrayPrototypePrototype typedArrayPrototype = new TypedArrayPrototypePrototype(realm);
TypedArrayConstructor int8ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Int8);
TypedArrayPrototype int8ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Int8);
TypedArrayConstructor uint8ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Uint8);
TypedArrayPrototype uint8ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Uint8);
TypedArrayConstructor uint8CArrayConstructor = new TypedArrayConstructor(realm, ElementType.Uint8C);
TypedArrayPrototype uint8CArrayPrototype = new TypedArrayPrototype(realm, ElementType.Uint8C);
TypedArrayConstructor int16ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Int16);
TypedArrayPrototype int16ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Int16);
TypedArrayConstructor uint16ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Uint16);
TypedArrayPrototype uint16ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Uint16);
TypedArrayConstructor int32ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Int32);
TypedArrayPrototype int32ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Int32);
TypedArrayConstructor uint32ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Uint32);
TypedArrayPrototype uint32ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Uint32);
TypedArrayConstructor float32ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Float32);
TypedArrayPrototype float32ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Float32);
TypedArrayConstructor float64ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Float64);
TypedArrayPrototype float64ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Float64);
DataViewConstructor dataViewConstructor = new DataViewConstructor(realm);
DataViewPrototype dataViewPrototype = new DataViewPrototype(realm);
// registration phase
intrinsics.put(Intrinsics.ArrayBuffer, arrayBufferConstructor);
intrinsics.put(Intrinsics.ArrayBufferPrototype, arrayBufferPrototype);
intrinsics.put(Intrinsics.TypedArray, typedArrayConstructor);
intrinsics.put(Intrinsics.TypedArrayPrototype, typedArrayPrototype);
intrinsics.put(Intrinsics.Int8Array, int8ArrayConstructor);
intrinsics.put(Intrinsics.Int8ArrayPrototype, int8ArrayPrototype);
intrinsics.put(Intrinsics.Uint8Array, uint8ArrayConstructor);
intrinsics.put(Intrinsics.Uint8ArrayPrototype, uint8ArrayPrototype);
intrinsics.put(Intrinsics.Uint8ClampedArray, uint8CArrayConstructor);
intrinsics.put(Intrinsics.Uint8ClampedArrayPrototype, uint8CArrayPrototype);
intrinsics.put(Intrinsics.Int16Array, int16ArrayConstructor);
intrinsics.put(Intrinsics.Int16ArrayPrototype, int16ArrayPrototype);
intrinsics.put(Intrinsics.Uint16Array, uint16ArrayConstructor);
intrinsics.put(Intrinsics.Uint16ArrayPrototype, uint16ArrayPrototype);
intrinsics.put(Intrinsics.Int32Array, int32ArrayConstructor);
intrinsics.put(Intrinsics.Int32ArrayPrototype, int32ArrayPrototype);
intrinsics.put(Intrinsics.Uint32Array, uint32ArrayConstructor);
intrinsics.put(Intrinsics.Uint32ArrayPrototype, uint32ArrayPrototype);
intrinsics.put(Intrinsics.Float32Array, float32ArrayConstructor);
intrinsics.put(Intrinsics.Float32ArrayPrototype, float32ArrayPrototype);
intrinsics.put(Intrinsics.Float64Array, float64ArrayConstructor);
intrinsics.put(Intrinsics.Float64ArrayPrototype, float64ArrayPrototype);
intrinsics.put(Intrinsics.DataView, dataViewConstructor);
intrinsics.put(Intrinsics.DataViewPrototype, dataViewPrototype);
// initialization phase
arrayBufferConstructor.initialize(realm);
arrayBufferPrototype.initialize(realm);
typedArrayConstructor.initialize(realm);
typedArrayPrototype.initialize(realm);
int8ArrayConstructor.initialize(realm);
int8ArrayPrototype.initialize(realm);
uint8ArrayConstructor.initialize(realm);
uint8ArrayPrototype.initialize(realm);
uint8CArrayConstructor.initialize(realm);
uint8CArrayPrototype.initialize(realm);
int16ArrayConstructor.initialize(realm);
int16ArrayPrototype.initialize(realm);
uint16ArrayConstructor.initialize(realm);
uint16ArrayPrototype.initialize(realm);
int32ArrayConstructor.initialize(realm);
int32ArrayPrototype.initialize(realm);
uint32ArrayConstructor.initialize(realm);
uint32ArrayPrototype.initialize(realm);
float32ArrayConstructor.initialize(realm);
float32ArrayPrototype.initialize(realm);
float64ArrayConstructor.initialize(realm);
float64ArrayPrototype.initialize(realm);
dataViewConstructor.initialize(realm);
dataViewPrototype.initialize(realm);
}
use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.
the class Realm method initializeAsyncModule.
/**
* <h1>Extension: Async Function Declaration</h1>
*
* @param realm
* the realm instance
*/
private static void initializeAsyncModule(Realm realm) {
EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
// allocation phase
AsyncFunctionConstructor asyncFunctionConstructor = new AsyncFunctionConstructor(realm);
AsyncFunctionPrototype asyncFunctionPrototype = new AsyncFunctionPrototype(realm);
// registration phase
intrinsics.put(Intrinsics.AsyncFunction, asyncFunctionConstructor);
intrinsics.put(Intrinsics.AsyncFunctionPrototype, asyncFunctionPrototype);
// initialization phase
asyncFunctionConstructor.initialize(realm);
asyncFunctionPrototype.initialize(realm);
}
use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.
the class Realm method initializeInternationalisation.
/**
* <h1>Internationalisation API (ECMA-402)</h1><br>
* <h2>8 The Intl Object - 12 DateTimeFormat Objects</h2>
*
* Additional built-in objects from the Internationalisation API
*
* @param realm
* the realm instance
*/
private static void initializeInternationalisation(Realm realm) {
EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
// allocation phase
IntlObject intlObject = new IntlObject(realm);
CollatorConstructor collatorConstructor = new CollatorConstructor(realm);
CollatorPrototype collatorPrototype = new CollatorPrototype(realm);
NumberFormatConstructor numberFormatConstructor = new NumberFormatConstructor(realm);
NumberFormatPrototype numberFormatPrototype = new NumberFormatPrototype(realm);
DateTimeFormatConstructor dateTimeFormatConstructor = new DateTimeFormatConstructor(realm);
DateTimeFormatPrototype dateTimeFormatPrototype = new DateTimeFormatPrototype(realm);
PluralRulesConstructor pluralRulesConstructor = null;
PluralRulesPrototype pluralRulesPrototype = null;
if (realm.isEnabled(CompatibilityOption.PluralRules)) {
pluralRulesConstructor = new PluralRulesConstructor(realm);
pluralRulesPrototype = new PluralRulesPrototype(realm);
}
// registration phase
intrinsics.put(Intrinsics.Intl, intlObject);
intrinsics.put(Intrinsics.Intl_Collator, collatorConstructor);
intrinsics.put(Intrinsics.Intl_CollatorPrototype, collatorPrototype);
intrinsics.put(Intrinsics.Intl_NumberFormat, numberFormatConstructor);
intrinsics.put(Intrinsics.Intl_NumberFormatPrototype, numberFormatPrototype);
intrinsics.put(Intrinsics.Intl_DateTimeFormat, dateTimeFormatConstructor);
intrinsics.put(Intrinsics.Intl_DateTimeFormatPrototype, dateTimeFormatPrototype);
if (pluralRulesConstructor != null) {
intrinsics.put(Intrinsics.Intl_PluralRules, pluralRulesConstructor);
intrinsics.put(Intrinsics.Intl_PluralRulesPrototype, pluralRulesPrototype);
}
// initialization phase
intlObject.initialize(realm);
collatorConstructor.initialize(realm);
collatorPrototype.initialize(realm);
numberFormatConstructor.initialize(realm);
numberFormatPrototype.initialize(realm);
dateTimeFormatConstructor.initialize(realm);
dateTimeFormatPrototype.initialize(realm);
if (pluralRulesConstructor != null) {
pluralRulesConstructor.initialize(realm);
pluralRulesPrototype.initialize(realm);
}
}
use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject in project es6draft by anba.
the class Realm method initializeAsyncIterationModule.
/**
* <h1>Extension: Async Generator Function Declaration</h1>
*
* @param realm
* the realm instance
*/
private static void initializeAsyncIterationModule(Realm realm) {
EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
// allocation phase
AsyncGeneratorFunctionConstructor asyncGenFunctionConstructor = new AsyncGeneratorFunctionConstructor(realm);
AsyncGeneratorPrototype asyncGeneratorPrototype = new AsyncGeneratorPrototype(realm);
AsyncGeneratorFunctionPrototype asyncGenerator = new AsyncGeneratorFunctionPrototype(realm);
AsyncIteratorPrototype asyncIteratorPrototype = new AsyncIteratorPrototype(realm);
// registration phase
intrinsics.put(Intrinsics.AsyncGeneratorFunction, asyncGenFunctionConstructor);
intrinsics.put(Intrinsics.AsyncGeneratorPrototype, asyncGeneratorPrototype);
intrinsics.put(Intrinsics.AsyncGenerator, asyncGenerator);
intrinsics.put(Intrinsics.AsyncIteratorPrototype, asyncIteratorPrototype);
// initialization phase
asyncGenFunctionConstructor.initialize(realm);
asyncGeneratorPrototype.initialize(realm);
asyncGenerator.initialize(realm);
asyncIteratorPrototype.initialize(realm);
}
Aggregations