mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
LibJS: Move intrinsics to the realm
Intrinsics, i.e. mostly constructor and prototype objects, but also things like empty and new object shape now live on a new heap-allocated JS::Intrinsics object, thus completing the long journey of taking all the magic away from the global object. This represents the Realm's [[Intrinsics]] slot in the spec and matches its existing [[GlobalObject]] / [[GlobalEnv]] slots in terms of architecture. In the majority of cases it should now be possibly to fully allocate a regular object without the global object existing, and in fact that's what we do now - the realm is allocated before the global object, and the intrinsics between both :^)
This commit is contained in:
parent
84c4b66721
commit
50428ea8d2
217 changed files with 1305 additions and 1039 deletions
|
@ -402,7 +402,7 @@ ThrowCompletionOr<Vector<PatternPartition>> partition_duration_format_pattern(VM
|
|||
}
|
||||
|
||||
// o. Let nf be ? Construct(%NumberFormat%, « durationFormat.[[Locale]], nfOpts »).
|
||||
auto* number_format = static_cast<Intl::NumberFormat*>(TRY(construct(vm, *realm.global_object().intl_number_format_constructor(), js_string(vm, duration_format.locale()), number_format_options)));
|
||||
auto* number_format = static_cast<NumberFormat*>(TRY(construct(vm, *realm.intrinsics().intl_number_format_constructor(), js_string(vm, duration_format.locale()), number_format_options)));
|
||||
|
||||
// FIXME: durationFormat.[[NumberFormat]] is not a thing, the spec likely means 'nf' in this case
|
||||
// p. Let num be ! FormatNumeric(durationFormat.[[NumberFormat]], value).
|
||||
|
@ -431,7 +431,7 @@ ThrowCompletionOr<Vector<PatternPartition>> partition_duration_format_pattern(VM
|
|||
// t. Else,
|
||||
else {
|
||||
// i. Let pr be ? Construct(%PluralRules%, « durationFormat.[[Locale]] »).
|
||||
auto* plural_rules = TRY(construct(vm, *realm.global_object().intl_plural_rules_constructor(), js_string(vm, duration_format.locale())));
|
||||
auto* plural_rules = TRY(construct(vm, *realm.intrinsics().intl_plural_rules_constructor(), js_string(vm, duration_format.locale())));
|
||||
|
||||
// ii. Let prv be ! ResolvePlural(pr, value).
|
||||
auto plurality = resolve_plural(static_cast<PluralRules&>(*plural_rules), value);
|
||||
|
@ -479,7 +479,7 @@ ThrowCompletionOr<Vector<PatternPartition>> partition_duration_format_pattern(VM
|
|||
}
|
||||
|
||||
// 3. Let lf be ? Construct(%ListFormat%, « durationFormat.[[Locale]] »).
|
||||
auto* list_format = static_cast<Intl::ListFormat*>(TRY(construct(vm, *realm.global_object().intl_list_format_constructor(), js_string(vm, duration_format.locale()))));
|
||||
auto* list_format = static_cast<ListFormat*>(TRY(construct(vm, *realm.intrinsics().intl_list_format_constructor(), js_string(vm, duration_format.locale()))));
|
||||
|
||||
// FIXME: CreatePartsFromList expects a list of strings and creates a list of Pattern Partition records, but we already created a list of Pattern Partition records
|
||||
// so we try to hack something together from it that looks mostly right
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue