diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp index 3094f7cd0c..8ae98f2788 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp @@ -36,7 +36,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::slice) { // 1. Let O be the this value. // 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). - auto* array_buffer_object = TRY(typed_this_value(global_object)); + auto* array_buffer_object = TRY(typed_this_value(vm)); // 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. // FIXME: Check for shared buffer @@ -125,7 +125,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::byte_length_getter) { // 1. Let O be the this value. // 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). - auto* array_buffer_object = TRY(typed_this_value(global_object)); + auto* array_buffer_object = TRY(typed_this_value(vm)); // 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. // FIXME: Check for shared buffer diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp index 00e126eba6..579a0b3eb8 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp @@ -36,7 +36,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next) { auto& realm = *global_object.associated_realm(); - auto* iterator = TRY(typed_this_value(global_object)); + auto* iterator = TRY(typed_this_value(vm)); auto target_array = iterator->array(); if (target_array.is_undefined()) return create_iterator_result_object(global_object, js_undefined(), true); diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp index 1fb8f8ef48..a03d57b69f 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp @@ -70,7 +70,7 @@ JS_DEFINE_NATIVE_FUNCTION(AsyncFromSyncIteratorPrototype::next) { // 1. Let O be the this value. // 2. Assert: O is an Object that has a [[SyncIteratorRecord]] internal slot. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); // 3. Let promiseCapability be ! NewPromiseCapability(%Promise%). auto promise_capability = MUST(new_promise_capability(global_object, global_object.promise_constructor())); @@ -98,7 +98,7 @@ JS_DEFINE_NATIVE_FUNCTION(AsyncFromSyncIteratorPrototype::return_) // 1. Let O be the this value. // 2. Assert: O is an Object that has a [[SyncIteratorRecord]] internal slot. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); // 3. Let promiseCapability be ! NewPromiseCapability(%Promise%). auto promise_capability = MUST(new_promise_capability(global_object, global_object.promise_constructor())); @@ -151,7 +151,7 @@ JS_DEFINE_NATIVE_FUNCTION(AsyncFromSyncIteratorPrototype::throw_) // 1. Let O be the this value. // 2. Assert: O is an Object that has a [[SyncIteratorRecord]] internal slot. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); // 3. Let promiseCapability be ! NewPromiseCapability(%Promise%). auto promise_capability = MUST(new_promise_capability(global_object, global_object.promise_constructor())); diff --git a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp index 44c32f9594..c4de5cca59 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp @@ -55,7 +55,7 @@ template static ThrowCompletionOr get_view_value(GlobalObject& global_object, Value request_index, Value is_little_endian) { auto& vm = global_object.vm(); - auto* view = TRY(DataViewPrototype::typed_this_value(global_object)); + auto* view = TRY(DataViewPrototype::typed_this_value(vm)); auto get_index = TRY(request_index.to_index(global_object)); auto little_endian = is_little_endian.to_boolean(); @@ -85,7 +85,7 @@ template static ThrowCompletionOr set_view_value(GlobalObject& global_object, Value request_index, Value is_little_endian, Value value) { auto& vm = global_object.vm(); - auto* view = TRY(DataViewPrototype::typed_this_value(global_object)); + auto* view = TRY(DataViewPrototype::typed_this_value(vm)); auto get_index = TRY(request_index.to_index(global_object)); Value number_value; @@ -233,14 +233,14 @@ JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_uint_32) // 25.3.4.1 get DataView.prototype.buffer, https://tc39.es/ecma262/#sec-get-dataview.prototype.buffer JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::buffer_getter) { - auto* data_view = TRY(typed_this_value(global_object)); + auto* data_view = TRY(typed_this_value(vm)); return data_view->viewed_array_buffer(); } // 25.3.4.2 get DataView.prototype.byteLength, https://tc39.es/ecma262/#sec-get-dataview.prototype.bytelength JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::byte_length_getter) { - auto* data_view = TRY(typed_this_value(global_object)); + auto* data_view = TRY(typed_this_value(vm)); if (data_view->viewed_array_buffer()->is_detached()) return vm.throw_completion(ErrorType::DetachedArrayBuffer); return Value(data_view->byte_length()); @@ -249,7 +249,7 @@ JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::byte_length_getter) // 25.3.4.3 get DataView.prototype.byteOffset, https://tc39.es/ecma262/#sec-get-dataview.prototype.byteoffset JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::byte_offset_getter) { - auto* data_view = TRY(typed_this_value(global_object)); + auto* data_view = TRY(typed_this_value(vm)); if (data_view->viewed_array_buffer()->is_detached()) return vm.throw_completion(ErrorType::DetachedArrayBuffer); return Value(data_view->byte_offset()); diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp index 03ba9700d5..6184dc8005 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -404,7 +404,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_date) new_date = time_clip(utc_time(new_date)); // 7. Set the [[DateValue]] internal slot of this Date object to u. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(new_date); // 8. Return u. @@ -439,7 +439,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_full_year) new_date = time_clip(utc_time(new_date)); // 8. Set the [[DateValue]] internal slot of this Date object to u. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(new_date); // 9. Return u. @@ -491,7 +491,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_hours) date = time_clip(utc_time(date)); // 13. Set the [[DateValue]] internal slot of this Date object to u. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(date); // 14. Return u. @@ -526,7 +526,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_milliseconds) date = time_clip(utc_time(date)); // 7. Set the [[DateValue]] internal slot of this Date object to u. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(date); // 8. Return u. @@ -573,7 +573,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_minutes) date = time_clip(utc_time(date)); // 11. Set the [[DateValue]] internal slot of this Date object to u. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(date); // 12. Return u. @@ -613,7 +613,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_month) new_date = time_clip(utc_time(new_date)); // 9. Set the [[DateValue]] internal slot of this Date object to u. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(new_date); // 10. Return u. @@ -654,7 +654,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_seconds) new_date = time_clip(utc_time(new_date)); // 9. Set the [[DateValue]] internal slot of this Date object to u. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(new_date); // 10. Return u. @@ -674,7 +674,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_time) time = time_clip(time); // 4. Set the [[DateValue]] internal slot of this Date object to v. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(time); // 5. Return v. @@ -705,7 +705,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_date) new_date = time_clip(new_date); // 6. Set the [[DateValue]] internal slot of this Date object to v. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(new_date); // 7. Return v. @@ -740,7 +740,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_full_year) new_date = time_clip(new_date); // 8. Set the [[DateValue]] internal slot of this Date object to v. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(new_date); // 9. Return v. @@ -789,7 +789,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_hours) date = time_clip(date); // 12. Set the [[DateValue]] internal slot of this Date object to v. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(date); // 13. Return v. @@ -821,7 +821,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_milliseconds) date = time_clip(date); // 6. Set the [[DateValue]] internal slot of this Date object to v. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(date); // 7. Return v. @@ -865,7 +865,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_minutes) date = time_clip(date); // 10. Set the [[DateValue]] internal slot of this Date object to v. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(date); // 11. Return v. @@ -902,7 +902,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_month) new_date = time_clip(new_date); // 8. Set the [[DateValue]] internal slot of this Date object to v. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(new_date); // 9. Return v. @@ -940,7 +940,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_utc_seconds) new_date = time_clip(new_date); // 8. Set the [[DateValue]] internal slot of this Date object to v. - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); this_object->set_date_value(new_date); // 9. Return v. @@ -966,7 +966,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_date_string) // 21.4.4.36 Date.prototype.toISOString ( ), https://tc39.es/ecma262/#sec-date.prototype.toisostring JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_iso_string) { - auto* this_object = TRY(typed_this_object(global_object)); + auto* this_object = TRY(typed_this_object(vm)); if (!Value(this_object->date_value()).is_finite_number()) return vm.throw_completion(ErrorType::InvalidTimeValue); @@ -1284,7 +1284,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::set_year) // 3. Let y be ? ToNumber(year). auto year = TRY(vm.argument(0).to_number(global_object)).as_double(); - auto* this_object = MUST(typed_this_object(global_object)); + auto* this_object = MUST(typed_this_object(vm)); // 4. If y is NaN, then if (isnan(year)) { diff --git a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp index 9daf1f917f..4cb6b919f9 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -39,7 +39,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string) { // 1. Let O be the this value. // 2. If Type(O) is not Object, throw a TypeError exception. - auto* this_object = TRY(PrototypeObject::this_object(global_object)); + auto* this_object = TRY(PrototypeObject::this_object(vm)); // 3. Let name be ? Get(O, "name"). auto name_property = TRY(this_object->get(vm.names.name)); @@ -74,7 +74,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_getter) { // 1. Let E be the this value. // 2. If ! Type(E) is not Object, throw a TypeError exception. - auto* this_object = TRY(PrototypeObject::this_object(global_object)); + auto* this_object = TRY(PrototypeObject::this_object(vm)); // 3. If E does not have an [[ErrorData]] internal slot, return undefined. if (!is(this_object)) diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp index 9a1f070edb..e09d286e47 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp @@ -31,7 +31,7 @@ void FinalizationRegistryPrototype::initialize(Realm& realm) // @STAGE 2@ FinalizationRegistry.prototype.cleanupSome ( [ callback ] ), https://github.com/tc39/proposal-cleanup-some/blob/master/spec/finalization-registry.html JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some) { - auto* finalization_registry = TRY(typed_this_object(global_object)); + auto* finalization_registry = TRY(typed_this_object(vm)); auto callback = vm.argument(0); if (vm.argument_count() > 0 && !callback.is_function()) @@ -47,7 +47,7 @@ JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some) // 26.2.3.2 FinalizationRegistry.prototype.register ( target, heldValue [ , unregisterToken ] ), https://tc39.es/ecma262/#sec-finalization-registry.prototype.register JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::register_) { - auto* finalization_registry = TRY(typed_this_object(global_object)); + auto* finalization_registry = TRY(typed_this_object(vm)); auto target = vm.argument(0); if (!can_be_held_weakly(target)) @@ -69,7 +69,7 @@ JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::register_) // 26.2.3.3 FinalizationRegistry.prototype.unregister ( unregisterToken ), https://tc39.es/ecma262/#sec-finalization-registry.prototype.unregister JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::unregister) { - auto* finalization_registry = TRY(typed_this_object(global_object)); + auto* finalization_registry = TRY(typed_this_object(vm)); auto unregister_token = vm.argument(0); if (!can_be_held_weakly(unregister_token)) diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp index 0386d9af2e..3aaecb2775 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp @@ -30,14 +30,14 @@ void GeneratorPrototype::initialize(Realm& realm) // 27.5.1.2 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.next JS_DEFINE_NATIVE_FUNCTION(GeneratorPrototype::next) { - auto* generator_object = TRY(typed_this_object(global_object)); + auto* generator_object = TRY(typed_this_object(vm)); return generator_object->next_impl(vm, global_object, vm.argument(0), {}); } // 27.5.1.3 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.return JS_DEFINE_NATIVE_FUNCTION(GeneratorPrototype::return_) { - auto* generator_object = TRY(typed_this_object(global_object)); + auto* generator_object = TRY(typed_this_object(vm)); generator_object->set_done(); return generator_object->next_impl(vm, global_object, {}, {}); } @@ -45,7 +45,7 @@ JS_DEFINE_NATIVE_FUNCTION(GeneratorPrototype::return_) // 27.5.1.4 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.throw JS_DEFINE_NATIVE_FUNCTION(GeneratorPrototype::throw_) { - auto* generator_object = TRY(typed_this_object(global_object)); + auto* generator_object = TRY(typed_this_object(vm)); return generator_object->next_impl(vm, global_object, {}, vm.argument(0)); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp index 499269b1af..e5b06190a8 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp @@ -38,7 +38,7 @@ JS_DEFINE_NATIVE_FUNCTION(CollatorPrototype::compare_getter) // 1. Let collator be the this value. // 2. Perform ? RequireInternalSlot(collator, [[InitializedCollator]]). - auto* collator = TRY(typed_this_object(global_object)); + auto* collator = TRY(typed_this_object(vm)); // 3. If collator.[[BoundCompare]] is undefined, then if (!collator->bound_compare()) { @@ -61,7 +61,7 @@ JS_DEFINE_NATIVE_FUNCTION(CollatorPrototype::resolved_options) // 1. Let collator be the this value. // 2. Perform ? RequireInternalSlot(collator, [[InitializedCollator]]). - auto* collator = TRY(typed_this_object(global_object)); + auto* collator = TRY(typed_this_object(vm)); // 3. Let options be OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp index 671c802557..53be35abce 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp @@ -46,7 +46,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateTimeFormatPrototype::format) // 2. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then // a. Set dtf to ? UnwrapDateTimeFormat(dtf). // 3. Perform ? RequireInternalSlot(dtf, [[InitializedDateTimeFormat]]). - auto* date_time_format = TRY(typed_this_object(global_object)); + auto* date_time_format = TRY(typed_this_object(vm)); // 4. If dtf.[[BoundFormat]] is undefined, then if (!date_time_format->bound_format()) { @@ -69,7 +69,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateTimeFormatPrototype::format_to_parts) // 1. Let dtf be the this value. // 2. Perform ? RequireInternalSlot(dtf, [[InitializedDateTimeFormat]]). - auto* date_time_format = TRY(typed_this_object(global_object)); + auto* date_time_format = TRY(typed_this_object(vm)); double date_value; @@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateTimeFormatPrototype::format_range) // 1. Let dtf be this value. // 2. Perform ? RequireInternalSlot(dtf, [[InitializedDateTimeFormat]]). - auto* date_time_format = TRY(typed_this_object(global_object)); + auto* date_time_format = TRY(typed_this_object(vm)); // 3. If startDate is undefined or endDate is undefined, throw a TypeError exception. if (start_date.is_undefined()) @@ -123,7 +123,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateTimeFormatPrototype::format_range_to_parts) // 1. Let dtf be this value. // 2. Perform ? RequireInternalSlot(dtf, [[InitializedDateTimeFormat]]). - auto* date_time_format = TRY(typed_this_object(global_object)); + auto* date_time_format = TRY(typed_this_object(vm)); // 3. If startDate is undefined or endDate is undefined, throw a TypeError exception. if (start_date.is_undefined()) @@ -150,7 +150,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateTimeFormatPrototype::resolved_options) // 2. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then // a. Set dtf to ? UnwrapDateTimeFormat(dtf). // 3. Perform ? RequireInternalSlot(dtf, [[InitializedDateTimeFormat]]). - auto* date_time_format = TRY(typed_this_object(global_object)); + auto* date_time_format = TRY(typed_this_object(vm)); // 4. Let options be OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp index 358b890a60..5088e0cffe 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp @@ -40,7 +40,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::of) // 1. Let displayNames be this value. // 2. Perform ? RequireInternalSlot(displayNames, [[InitializedDisplayNames]]). - auto* display_names = TRY(typed_this_object(global_object)); + auto* display_names = TRY(typed_this_object(vm)); // 3. Let code be ? ToString(code). auto code_string = TRY(code.to_string(global_object)); @@ -128,7 +128,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::resolved_options) // 1. Let displayNames be this value. // 2. Perform ? RequireInternalSlot(displayNames, [[InitializedDisplayNames]]). - auto* display_names = TRY(typed_this_object(global_object)); + auto* display_names = TRY(typed_this_object(vm)); // 3. Let options be OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp index c8fd7eff01..0e4eb6df14 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp @@ -36,7 +36,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format) { // 1. Let df be this value. // 2. Perform ? RequireInternalSlot(df, [[InitializedDurationFormat]]). - auto* duration_format = TRY(typed_this_object(global_object)); + auto* duration_format = TRY(typed_this_object(vm)); // 3. Let record be ? ToDurationRecord(duration). auto record = TRY(to_duration_record(vm, vm.argument(0))); @@ -68,7 +68,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format_to_parts) // 1. Let df be this value. // 2. Perform ? RequireInternalSlot(df, [[InitializedDurationFormat]]). - auto* duration_format = TRY(typed_this_object(global_object)); + auto* duration_format = TRY(typed_this_object(vm)); // 3. Let record be ? ToDurationRecord(duration). auto record = TRY(to_duration_record(vm, vm.argument(0))); @@ -114,7 +114,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::resolved_options) // 1. Let df be the this value. // 2. Perform ? RequireInternalSlot(df, [[InitializedDurationFormat]]). - auto* duration_format = TRY(typed_this_object(global_object)); + auto* duration_format = TRY(typed_this_object(vm)); // 3. Let options be ! OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp index 7ac5d454a1..204cc07ec9 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp @@ -40,7 +40,7 @@ JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::format) // 1. Let lf be the this value. // 2. Perform ? RequireInternalSlot(lf, [[InitializedListFormat]]). - auto* list_format = TRY(typed_this_object(global_object)); + auto* list_format = TRY(typed_this_object(vm)); // 3. Let stringList be ? StringListFromIterable(list). auto string_list = TRY(string_list_from_iterable(vm, list)); @@ -57,7 +57,7 @@ JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::format_to_parts) // 1. Let lf be the this value. // 2. Perform ? RequireInternalSlot(lf, [[InitializedListFormat]]). - auto* list_format = TRY(typed_this_object(global_object)); + auto* list_format = TRY(typed_this_object(vm)); // 3. Let stringList be ? StringListFromIterable(list). auto string_list = TRY(string_list_from_iterable(vm, list)); @@ -73,7 +73,7 @@ JS_DEFINE_NATIVE_FUNCTION(ListFormatPrototype::resolved_options) // 1. Let lf be the this value. // 2. Perform ? RequireInternalSlot(lf, [[InitializedListFormat]]). - auto* list_format = TRY(typed_this_object(global_object)); + auto* list_format = TRY(typed_this_object(vm)); // 3. Let options be OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp index f8d447c0e2..be1e4ed8ad 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp @@ -59,7 +59,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::maximize) // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); auto locale = Unicode::parse_unicode_locale_id(locale_object->locale()); VERIFY(locale.has_value()); @@ -79,7 +79,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::minimize) // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); auto locale = Unicode::parse_unicode_locale_id(locale_object->locale()); VERIFY(locale.has_value()); @@ -97,7 +97,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::to_string) { // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); // 3. Return loc.[[Locale]]. return js_string(vm, locale_object->locale()); @@ -108,7 +108,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::base_name) { // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); // 3. Let locale be loc.[[Locale]]. auto locale = Unicode::parse_unicode_locale_id(locale_object->locale()); @@ -130,13 +130,13 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::base_name) // 14.3.9 get Intl.Locale.prototype.collation, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.collation // 14.3.10 get Intl.Locale.prototype.hourCycle, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.hourCycle // 14.3.12 get Intl.Locale.prototype.numberingSystem, https://tc39.es/ecma402/#sec-Intl.Locale.prototype.numberingSystem -#define __JS_ENUMERATE(keyword) \ - JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::keyword) \ - { \ - auto* locale_object = TRY(typed_this_object(global_object)); \ - if (!locale_object->has_##keyword()) \ - return js_undefined(); \ - return js_string(vm, locale_object->keyword()); \ +#define __JS_ENUMERATE(keyword) \ + JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::keyword) \ + { \ + auto* locale_object = TRY(typed_this_object(vm)); \ + if (!locale_object->has_##keyword()) \ + return js_undefined(); \ + return js_string(vm, locale_object->keyword()); \ } JS_ENUMERATE_LOCALE_KEYWORD_PROPERTIES #undef __JS_ENUMERATE @@ -146,7 +146,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::numeric) { // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); // 3. Return loc.[[Numeric]]. return Value(locale_object->numeric()); @@ -157,7 +157,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::language) { // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); // 3. Let locale be loc.[[Locale]]. auto locale = Unicode::parse_unicode_locale_id(locale_object->locale()); @@ -174,7 +174,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::script) { // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); // 3. Let locale be loc.[[Locale]]. auto locale = Unicode::parse_unicode_locale_id(locale_object->locale()); @@ -195,7 +195,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::region) { // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); // 3. Let locale be loc.[[Locale]]. auto locale = Unicode::parse_unicode_locale_id(locale_object->locale()); @@ -221,11 +221,11 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::region) // 1.4.17 get Intl.Locale.prototype.collations, https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.collations // 1.4.18 get Intl.Locale.prototype.hourCycles, https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.hourCycles // 1.4.19 get Intl.Locale.prototype.numberingSystems, https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.numberingSystems -#define __JS_ENUMERATE(keyword) \ - JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::keyword) \ - { \ - auto* locale_object = TRY(typed_this_object(global_object)); \ - return keyword##_of_locale(vm, *locale_object); \ +#define __JS_ENUMERATE(keyword) \ + JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::keyword) \ + { \ + auto* locale_object = TRY(typed_this_object(vm)); \ + return keyword##_of_locale(vm, *locale_object); \ } JS_ENUMERATE_LOCALE_INFO_PROPERTIES #undef __JS_ENUMERATE @@ -235,7 +235,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::time_zones) { // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); // 3. Let locale be loc.[[Locale]]. auto locale = Unicode::parse_unicode_locale_id(locale_object->locale()); @@ -255,7 +255,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::text_info) // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - auto* locale_object = TRY(typed_this_object(global_object)); + auto* locale_object = TRY(typed_this_object(vm)); // 3. Let info be ! ObjectCreate(%Object.prototype%). auto* info = Object::create(realm, global_object.object_prototype()); @@ -277,7 +277,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::week_info) // 1. Let loc be the this value. // 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]). - [[maybe_unused]] auto* locale_object = TRY(typed_this_object(global_object)); + [[maybe_unused]] auto* locale_object = TRY(typed_this_object(vm)); // 3. Let info be ! ObjectCreate(%Object.prototype%). auto* info = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp index e0e59c29e0..6470fc4bc0 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp @@ -46,7 +46,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberFormatPrototype::format) // 2. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then // a. Set nf to ? UnwrapNumberFormat(nf). // 3. Perform ? RequireInternalSlot(nf, [[InitializedNumberFormat]]). - auto* number_format = TRY(typed_this_object(global_object)); + auto* number_format = TRY(typed_this_object(vm)); // 4. If nf.[[BoundFormat]] is undefined, then if (!number_format->bound_format()) { @@ -70,7 +70,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberFormatPrototype::format_to_parts) // 1. Let nf be the this value. // 2. Perform ? RequireInternalSlot(nf, [[InitializedNumberFormat]]). - auto* number_format = TRY(typed_this_object(global_object)); + auto* number_format = TRY(typed_this_object(vm)); // 3. Let x be ? ToIntlMathematicalValue(value). auto mathematical_value = TRY(to_intl_mathematical_value(vm, value)); @@ -88,7 +88,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberFormatPrototype::format_range) // 1. Let nf be the this value. // 2. Perform ? RequireInternalSlot(nf, [[InitializedNumberFormat]]). - auto* number_format = TRY(typed_this_object(global_object)); + auto* number_format = TRY(typed_this_object(vm)); // 3. If start is undefined or end is undefined, throw a TypeError exception. if (start.is_undefined()) @@ -115,7 +115,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberFormatPrototype::format_range_to_parts) // 1. Let nf be the this value. // 2. Perform ? RequireInternalSlot(nf, [[InitializedNumberFormat]]). - auto* number_format = TRY(typed_this_object(global_object)); + auto* number_format = TRY(typed_this_object(vm)); // 3. If start is undefined or end is undefined, throw a TypeError exception. if (start.is_undefined()) @@ -142,7 +142,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberFormatPrototype::resolved_options) // 2. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then // a. Set nf to ? UnwrapNumberFormat(nf). // 3. Perform ? RequireInternalSlot(nf, [[InitializedNumberFormat]]). - auto* number_format = TRY(typed_this_object(global_object)); + auto* number_format = TRY(typed_this_object(vm)); // 4. Let options be OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp index 1862ae62eb..f0f88ea973 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp @@ -38,7 +38,7 @@ JS_DEFINE_NATIVE_FUNCTION(PluralRulesPrototype::select) { // 1. Let pr be the this value. // 2. Perform ? RequireInternalSlot(pr, [[InitializedPluralRules]]). - auto* plural_rules = TRY(typed_this_object(global_object)); + auto* plural_rules = TRY(typed_this_object(vm)); // 3. Let n be ? ToNumber(value). auto number = TRY(vm.argument(0).to_number(global_object)); @@ -56,7 +56,7 @@ JS_DEFINE_NATIVE_FUNCTION(PluralRulesPrototype::select_range) // 1. Let pr be the this value. // 2. Perform ? RequireInternalSlot(pr, [[InitializedPluralRules]]). - auto* plural_rules = TRY(typed_this_object(global_object)); + auto* plural_rules = TRY(typed_this_object(vm)); // 3. If start is undefined or end is undefined, throw a TypeError exception. if (start.is_undefined()) @@ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(PluralRulesPrototype::resolved_options) // 1. Let pr be the this value. // 2. Perform ? RequireInternalSlot(pr, [[InitializedPluralRules]]). - auto* plural_rules = TRY(typed_this_object(global_object)); + auto* plural_rules = TRY(typed_this_object(vm)); // 3. Let options be OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp index c90716e46e..31f71c6b8e 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp @@ -36,7 +36,7 @@ JS_DEFINE_NATIVE_FUNCTION(RelativeTimeFormatPrototype::format) { // 1. Let relativeTimeFormat be the this value. // 2. Perform ? RequireInternalSlot(relativeTimeFormat, [[InitializedRelativeTimeFormat]]). - auto* relative_time_format = TRY(typed_this_object(global_object)); + auto* relative_time_format = TRY(typed_this_object(vm)); // 3. Let value be ? ToNumber(value). auto value = TRY(vm.argument(0).to_number(global_object)); @@ -54,7 +54,7 @@ JS_DEFINE_NATIVE_FUNCTION(RelativeTimeFormatPrototype::format_to_parts) { // 1. Let relativeTimeFormat be the this value. // 2. Perform ? RequireInternalSlot(relativeTimeFormat, [[InitializedRelativeTimeFormat]]). - auto* relative_time_format = TRY(typed_this_object(global_object)); + auto* relative_time_format = TRY(typed_this_object(vm)); // 3. Let value be ? ToNumber(value). auto value = TRY(vm.argument(0).to_number(global_object)); @@ -73,7 +73,7 @@ JS_DEFINE_NATIVE_FUNCTION(RelativeTimeFormatPrototype::resolved_options) // 1. Let relativeTimeFormat be the this value. // 2. Perform ? RequireInternalSlot(relativeTimeFormat, [[InitializedRelativeTimeFormat]]). - auto* relative_time_format = TRY(typed_this_object(global_object)); + auto* relative_time_format = TRY(typed_this_object(vm)); // 3. Let options be OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp index 297c29ba4d..5f9d50da10 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp @@ -36,7 +36,7 @@ JS_DEFINE_NATIVE_FUNCTION(SegmentIteratorPrototype::next) { // 1. Let iterator be the this value. // 2. Perform ? RequireInternalSlot(iterator, [[IteratingSegmenter]]). - auto* iterator = TRY(typed_this_object(global_object)); + auto* iterator = TRY(typed_this_object(vm)); // 3. Let segmenter be iterator.[[IteratingSegmenter]]. auto const& segmenter = iterator->iterating_segmenter(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp index b42733cb01..8c9c6b914c 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp @@ -38,7 +38,7 @@ JS_DEFINE_NATIVE_FUNCTION(SegmenterPrototype::resolved_options) // 1. Let segmenter be the this value. // 2. Perform ? RequireInternalSlot(segmenter, [[InitializedSegmenter]]). - auto* segmenter = TRY(typed_this_object(global_object)); + auto* segmenter = TRY(typed_this_object(vm)); // 3. Let options be OrdinaryObjectCreate(%Object.prototype%). auto* options = Object::create(realm, global_object.object_prototype()); @@ -62,7 +62,7 @@ JS_DEFINE_NATIVE_FUNCTION(SegmenterPrototype::segment) // 1. Let segmenter be the this value. // 2. Perform ? RequireInternalSlot(segmenter, [[InitializedSegmenter]]). - auto* segmenter = TRY(typed_this_object(global_object)); + auto* segmenter = TRY(typed_this_object(vm)); // 3. Let string be ? ToString(string). auto string = TRY(vm.argument(0).to_utf16_string(global_object)); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp index b91698e609..5dfac3247c 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp @@ -33,7 +33,7 @@ JS_DEFINE_NATIVE_FUNCTION(SegmentsPrototype::containing) { // 1. Let segments be the this value. // 2. Perform ? RequireInternalSlot(segments, [[SegmentsSegmenter]]). - auto* segments = TRY(typed_this_object(global_object)); + auto* segments = TRY(typed_this_object(vm)); // 3. Let segmenter be segments.[[SegmentsSegmenter]]. auto const& segmenter = segments->segments_segmenter(); @@ -68,7 +68,7 @@ JS_DEFINE_NATIVE_FUNCTION(SegmentsPrototype::symbol_iterator) // 1. Let segments be the this value. // 2. Perform ? RequireInternalSlot(segments, [[SegmentsSegmenter]]). - auto* segments = TRY(typed_this_object(global_object)); + auto* segments = TRY(typed_this_object(vm)); // 3. Let segmenter be segments.[[SegmentsSegmenter]]. auto& segmenter = segments->segments_segmenter(); diff --git a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp index eacfd846b8..c524ce3bfa 100644 --- a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp @@ -32,7 +32,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapIteratorPrototype::next) { auto& realm = *global_object.associated_realm(); - auto* map_iterator = TRY(typed_this_value(global_object)); + auto* map_iterator = TRY(typed_this_value(vm)); if (map_iterator->done()) return create_iterator_result_object(global_object, js_undefined(), true); diff --git a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp index 0dd2f8ec45..a033cf3a29 100644 --- a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp @@ -42,7 +42,7 @@ void MapPrototype::initialize(Realm& realm) // 24.1.3.1 Map.prototype.clear ( ), https://tc39.es/ecma262/#sec-map.prototype.clear JS_DEFINE_NATIVE_FUNCTION(MapPrototype::clear) { - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); map->map_clear(); return js_undefined(); } @@ -50,7 +50,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::clear) // 24.1.3.3 Map.prototype.delete ( key ), https://tc39.es/ecma262/#sec-map.prototype.delete JS_DEFINE_NATIVE_FUNCTION(MapPrototype::delete_) { - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); return Value(map->map_remove(vm.argument(0))); } @@ -59,7 +59,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::entries) { auto& realm = *global_object.associated_realm(); - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); return MapIterator::create(realm, *map, Object::PropertyKind::KeyAndValue); } @@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::entries) // 24.1.3.5 Map.prototype.forEach ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-map.prototype.foreach JS_DEFINE_NATIVE_FUNCTION(MapPrototype::for_each) { - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); if (!vm.argument(0).is_function()) return vm.throw_completion(ErrorType::NotAFunction, vm.argument(0).to_string_without_side_effects()); auto this_value = vm.this_value(); @@ -79,7 +79,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::for_each) // 24.1.3.6 Map.prototype.get ( key ), https://tc39.es/ecma262/#sec-map.prototype.get JS_DEFINE_NATIVE_FUNCTION(MapPrototype::get) { - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); auto result = map->map_get(vm.argument(0)); if (!result.has_value()) return js_undefined(); @@ -89,7 +89,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::get) // 24.1.3.7 Map.prototype.has ( key ), https://tc39.es/ecma262/#sec-map.prototype.has JS_DEFINE_NATIVE_FUNCTION(MapPrototype::has) { - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); return map->map_has(vm.argument(0)); } @@ -98,7 +98,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::keys) { auto& realm = *global_object.associated_realm(); - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); return MapIterator::create(realm, *map, Object::PropertyKind::Key); } @@ -106,7 +106,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::keys) // 24.1.3.9 Map.prototype.set ( key, value ), https://tc39.es/ecma262/#sec-map.prototype.set JS_DEFINE_NATIVE_FUNCTION(MapPrototype::set) { - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); auto key = vm.argument(0); if (key.is_negative_zero()) key = Value(0); @@ -119,7 +119,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::values) { auto& realm = *global_object.associated_realm(); - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); return MapIterator::create(realm, *map, Object::PropertyKind::Value); } @@ -127,7 +127,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::values) // 24.1.3.10 get Map.prototype.size, https://tc39.es/ecma262/#sec-get-map.prototype.size JS_DEFINE_NATIVE_FUNCTION(MapPrototype::size_getter) { - auto* map = TRY(typed_this_object(global_object)); + auto* map = TRY(typed_this_object(vm)); return Value(map->map_size()); } diff --git a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp index fc3e9992da..a9ca8240b1 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp @@ -43,7 +43,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::then) // 1. Let promise be the this value. // 2. If IsPromise(promise) is false, throw a TypeError exception. - auto* promise = TRY(typed_this_object(global_object)); + auto* promise = TRY(typed_this_object(vm)); // 3. Let C be ? SpeciesConstructor(promise, %Promise%). auto* constructor = TRY(species_constructor(global_object, *promise, *global_object.promise_constructor())); diff --git a/Userland/Libraries/LibJS/Runtime/PrototypeObject.h b/Userland/Libraries/LibJS/Runtime/PrototypeObject.h index d6adf4c865..ce7f48fe2a 100644 --- a/Userland/Libraries/LibJS/Runtime/PrototypeObject.h +++ b/Userland/Libraries/LibJS/Runtime/PrototypeObject.h @@ -26,9 +26,8 @@ class PrototypeObject : public Object { public: virtual ~PrototypeObject() override = default; - static ThrowCompletionOr this_object(GlobalObject& global_object) + static ThrowCompletionOr this_object(VM& vm) { - auto& vm = global_object.vm(); auto this_value = vm.this_value(); if (!this_value.is_object()) return vm.throw_completion(ErrorType::NotAnObject, this_value); @@ -36,9 +35,10 @@ public: } // Use typed_this_object() when the spec coerces |this| value to an object. - static ThrowCompletionOr typed_this_object(GlobalObject& global_object) + static ThrowCompletionOr typed_this_object(VM& vm) { - auto& vm = global_object.vm(); + auto& realm = *vm.current_realm(); + auto& global_object = realm.global_object(); auto* this_object = TRY(vm.this_value().to_object(global_object)); if (!is(this_object)) return vm.throw_completion(ErrorType::NotAnObjectOfType, PrototypeType::display_name()); @@ -46,9 +46,8 @@ public: } // Use typed_this_value() when the spec does not coerce |this| value to an object. - static ThrowCompletionOr typed_this_value(GlobalObject& global_object) + static ThrowCompletionOr typed_this_value(VM& vm) { - auto& vm = global_object.vm(); auto this_value = vm.this_value(); if (!this_value.is_object() || !is(this_value.as_object())) return vm.throw_completion(ErrorType::NotAnObjectOfType, PrototypeType::display_name()); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index cb0c871e67..fe6850f742 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -419,7 +419,7 @@ size_t advance_string_index(Utf16View const& string, size_t index, bool unicode) JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::flag_name) \ { \ /* 1. If Type(R) is not Object, throw a TypeError exception. */ \ - auto* regexp_object = TRY(this_object(global_object)); \ + auto* regexp_object = TRY(this_object(vm)); \ /* 2. If R does not have an [[OriginalFlags]] internal slot, then */ \ if (!is(regexp_object)) { \ /* a. If SameValue(R, %RegExp.prototype%) is true, return undefined. */ \ @@ -442,7 +442,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::exec) { // 1. Let R be the this value. // 2. Perform ? RequireInternalSlot(R, [[RegExpMatcher]]). - auto* regexp_object = TRY(typed_this_object(global_object)); + auto* regexp_object = TRY(typed_this_object(vm)); // 3. Let S be ? ToString(string). auto string = TRY(vm.argument(0).to_utf16_string(global_object)); @@ -457,7 +457,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::flags) // 1. Let R be the this value. // 2. If Type(R) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. Let result be the empty String. StringBuilder builder(8); @@ -497,7 +497,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_match) // 1. Let rx be the this value. // 2. If Type(rx) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. Let S be ? ToString(string). auto string = TRY(vm.argument(0).to_utf16_string(global_object)); @@ -573,7 +573,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_match_all) // 1. Let R be the this value. // 2. If Type(R) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. Let S be ? ToString(string). auto string = TRY(vm.argument(0).to_utf16_string(global_object)); @@ -618,7 +618,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) // 1. Let rx be the this value. // 2. If Type(rx) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. Let S be ? ToString(string). auto string = TRY(string_value.to_utf16_string(global_object)); @@ -808,7 +808,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_search) { // 1. Let rx be the this value. // 2. If Type(rx) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. Let S be ? ToString(string). auto string = TRY(vm.argument(0).to_utf16_string(global_object)); @@ -847,7 +847,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::source) { // 1. Let R be the this value. // 2. If Type(R) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. If R does not have an [[OriginalSource]] internal slot, then if (!is(regexp_object)) { @@ -873,7 +873,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_split) // 1. Let rx be the this value. // 2. If Type(rx) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. Let S be ? ToString(string). auto string = TRY(vm.argument(0).to_utf16_string(global_object)); @@ -1027,7 +1027,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::test) { // 1. Let R be the this value. // 2. If Type(R) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. Let string be ? ToString(S). auto string = TRY(vm.argument(0).to_utf16_string(global_object)); @@ -1044,7 +1044,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::to_string) { // 1. Let R be the this value. // 2. If Type(R) is not Object, throw a TypeError exception. - auto* regexp_object = TRY(this_object(global_object)); + auto* regexp_object = TRY(this_object(vm)); // 3. Let pattern be ? ToString(? Get(R, "source")). auto source_attr = TRY(regexp_object->get(vm.names.source)); @@ -1067,7 +1067,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::compile) // 1. Let O be the this value. // 2. Perform ? RequireInternalSlot(O, [[RegExpMatcher]]). - auto* regexp_object = TRY(typed_this_object(global_object)); + auto* regexp_object = TRY(typed_this_object(vm)); // 3. If Type(pattern) is Object and pattern has a [[RegExpMatcher]] internal slot, then if (pattern.is_object() && is(pattern.as_object())) { diff --git a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp index 66de54761f..f1c386e574 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp @@ -33,7 +33,7 @@ void RegExpStringIteratorPrototype::initialize(Realm& realm) JS_DEFINE_NATIVE_FUNCTION(RegExpStringIteratorPrototype::next) { // For details, see the 'closure' of: https://tc39.es/ecma262/#sec-createregexpstringiterator - auto* iterator = TRY(typed_this_value(global_object)); + auto* iterator = TRY(typed_this_value(vm)); if (iterator->done()) return create_iterator_result_object(global_object, js_undefined(), true); diff --git a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp index a2495161c3..6060af048a 100644 --- a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp @@ -34,7 +34,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetIteratorPrototype::next) { auto& realm = *global_object.associated_realm(); - auto* set_iterator = TRY(typed_this_value(global_object)); + auto* set_iterator = TRY(typed_this_value(vm)); if (set_iterator->done()) return create_iterator_result_object(global_object, js_undefined(), true); diff --git a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp index 73620f7f6e..edd3978bf2 100644 --- a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp @@ -44,7 +44,7 @@ void SetPrototype::initialize(Realm& realm) // 24.2.3.1 Set.prototype.add ( value ), https://tc39.es/ecma262/#sec-set.prototype.add JS_DEFINE_NATIVE_FUNCTION(SetPrototype::add) { - auto* set = TRY(typed_this_object(global_object)); + auto* set = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (value.is_negative_zero()) value = Value(0); @@ -55,7 +55,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::add) // 24.2.3.2 Set.prototype.clear ( ), https://tc39.es/ecma262/#sec-set.prototype.clear JS_DEFINE_NATIVE_FUNCTION(SetPrototype::clear) { - auto* set = TRY(typed_this_object(global_object)); + auto* set = TRY(typed_this_object(vm)); set->set_clear(); return js_undefined(); } @@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::clear) // 24.2.3.4 Set.prototype.delete ( value ), https://tc39.es/ecma262/#sec-set.prototype.delete JS_DEFINE_NATIVE_FUNCTION(SetPrototype::delete_) { - auto* set = TRY(typed_this_object(global_object)); + auto* set = TRY(typed_this_object(vm)); return Value(set->set_remove(vm.argument(0))); } @@ -72,7 +72,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::entries) { auto& realm = *global_object.associated_realm(); - auto* set = TRY(typed_this_object(global_object)); + auto* set = TRY(typed_this_object(vm)); return SetIterator::create(realm, *set, Object::PropertyKind::KeyAndValue); } @@ -80,7 +80,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::entries) // 24.2.3.6 Set.prototype.forEach ( callbackfn [ , thisArg ] ), https://tc39.es/ecma262/#sec-set.prototype.foreach JS_DEFINE_NATIVE_FUNCTION(SetPrototype::for_each) { - auto* set = TRY(typed_this_object(global_object)); + auto* set = TRY(typed_this_object(vm)); if (!vm.argument(0).is_function()) return vm.throw_completion(ErrorType::NotAFunction, vm.argument(0).to_string_without_side_effects()); auto this_value = vm.this_value(); @@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::for_each) // 24.2.3.7 Set.prototype.has ( value ), https://tc39.es/ecma262/#sec-set.prototype.has JS_DEFINE_NATIVE_FUNCTION(SetPrototype::has) { - auto* set = TRY(typed_this_object(global_object)); + auto* set = TRY(typed_this_object(vm)); return Value(set->set_has(vm.argument(0))); } @@ -101,7 +101,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::values) { auto& realm = *global_object.associated_realm(); - auto* set = TRY(typed_this_object(global_object)); + auto* set = TRY(typed_this_object(vm)); return SetIterator::create(realm, *set, Object::PropertyKind::Value); } @@ -109,7 +109,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::values) // 24.2.3.9 get Set.prototype.size, https://tc39.es/ecma262/#sec-get-set.prototype.size JS_DEFINE_NATIVE_FUNCTION(SetPrototype::size_getter) { - auto* set = TRY(typed_this_object(global_object)); + auto* set = TRY(typed_this_object(vm)); return Value(set->set_size()); } diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp index 4b80913a91..9799ebc897 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp @@ -36,7 +36,7 @@ JS_DEFINE_NATIVE_FUNCTION(ShadowRealmPrototype::evaluate) // 1. Let O be this value. // 2. Perform ? ValidateShadowRealmObject(O). - auto* object = TRY(typed_this_object(global_object)); + auto* object = TRY(typed_this_object(vm)); // 3. If Type(sourceText) is not String, throw a TypeError exception. if (!source_text.is_string()) @@ -60,7 +60,7 @@ JS_DEFINE_NATIVE_FUNCTION(ShadowRealmPrototype::import_value) // 1. Let O be this value. // 2. Perform ? ValidateShadowRealmObject(O). - auto* object = TRY(typed_this_object(global_object)); + auto* object = TRY(typed_this_object(vm)); // 3. Let specifierString be ? ToString(specifier). auto specifier_string = TRY(specifier.to_string(global_object)); diff --git a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp index ff48e52220..4ad5724817 100644 --- a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp @@ -31,7 +31,7 @@ void StringIteratorPrototype::initialize(Realm& realm) // 22.1.5.1.1 %StringIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next JS_DEFINE_NATIVE_FUNCTION(StringIteratorPrototype::next) { - auto* iterator = TRY(typed_this_value(global_object)); + auto* iterator = TRY(typed_this_value(vm)); if (iterator->done()) return create_iterator_result_object(global_object, js_undefined(), true); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index 539ae57ecc..ea11e876dc 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::id_getter) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Return ? ToString(calendar). return { js_string(vm, TRY(Value(calendar).to_string(global_object))) }; @@ -79,7 +79,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_from_fields) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -105,7 +105,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year_month_from_fields) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -131,7 +131,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_day_from_fields) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -157,7 +157,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_add) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -191,7 +191,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_until) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -225,7 +225,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -247,7 +247,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -276,7 +276,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_code) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -298,7 +298,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::day) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -320,7 +320,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::day_of_week) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -351,7 +351,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::day_of_year) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -375,7 +375,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::week_of_year) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -393,7 +393,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::days_in_week) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -411,7 +411,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::days_in_month) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -433,7 +433,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::days_in_year) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -455,7 +455,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::months_in_year) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -477,7 +477,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::in_leap_year) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -507,7 +507,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields) // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Assert: calendar.[[Identifier]] is "iso8601". VERIFY(calendar->identifier() == "iso8601"sv); @@ -572,7 +572,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::merge_fields) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Set fields to ? ToObject(fields). auto* fields = TRY(vm.argument(0).to_object(global_object)); @@ -592,7 +592,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::to_string) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Return calendar.[[Identifier]]. return js_string(vm, calendar->identifier()); @@ -603,7 +603,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::to_json) { // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. Return ? ToString(calendar). return js_string(vm, TRY(Value(calendar).to_string(global_object))); @@ -616,7 +616,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::era) // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then if (!temporal_date_like.is_object() || !(is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()))) { @@ -644,7 +644,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::era_year) // 1. Let calendar be the this value. // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - auto* calendar = TRY(typed_this_object(global_object)); + auto* calendar = TRY(typed_this_object(vm)); // 3. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then if (!temporal_date_like.is_object() || !(is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()))) { diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp index a31231aa62..149f36791d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp @@ -61,7 +61,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::years_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Years]]). return Value(duration->years()); @@ -72,7 +72,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::months_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Months]]). return Value(duration->months()); @@ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::weeks_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Weeks]]). return Value(duration->weeks()); @@ -94,7 +94,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::days_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Days]]). return Value(duration->days()); @@ -105,7 +105,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::hours_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Hours]]). return Value(duration->hours()); @@ -116,7 +116,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::minutes_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Minutes]]). return Value(duration->minutes()); @@ -127,7 +127,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::seconds_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Seconds]]). return Value(duration->seconds()); @@ -138,7 +138,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::milliseconds_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Milliseconds]]). return Value(duration->milliseconds()); @@ -149,7 +149,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::microseconds_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Microseconds]]). return Value(duration->microseconds()); @@ -160,7 +160,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::nanoseconds_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(duration.[[Nanoseconds]]). return Value(duration->nanoseconds()); @@ -171,7 +171,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::sign_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return 𝔽(! DurationSign(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]])). return Value(duration_sign(duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds())); @@ -182,7 +182,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::blank_getter) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Let sign be ! DurationSign(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]]). auto sign = duration_sign(duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds()); @@ -200,7 +200,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::with) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Let temporalDurationLike be ? ToTemporalPartialDurationRecord(temporalDurationLike). auto temporal_duration_like = TRY(to_temporal_partial_duration_record(vm, vm.argument(0))); @@ -274,7 +274,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::negated) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return ! CreateNegatedTemporalDuration(duration). return create_negated_temporal_duration(vm, *duration); @@ -285,7 +285,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::abs) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return ! CreateTemporalDuration(abs(duration.[[Years]]), abs(duration.[[Months]]), abs(duration.[[Weeks]]), abs(duration.[[Days]]), abs(duration.[[Hours]]), abs(duration.[[Minutes]]), abs(duration.[[Seconds]]), abs(duration.[[Milliseconds]]), abs(duration.[[Microseconds]]), abs(duration.[[Nanoseconds]])). return TRY(create_temporal_duration(vm, fabs(duration->years()), fabs(duration->months()), fabs(duration->weeks()), fabs(duration->days()), fabs(duration->hours()), fabs(duration->minutes()), fabs(duration->seconds()), fabs(duration->milliseconds()), fabs(duration->microseconds()), fabs(duration->nanoseconds()))); @@ -299,7 +299,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::add) // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromDuration(add, duration, other, options). return TRY(add_duration_to_or_subtract_duration_from_duration(vm, ArithmeticOperation::Add, *duration, other, options)); @@ -313,7 +313,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::subtract) // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromDuration(subtract, duration, other, options). return TRY(add_duration_to_or_subtract_duration_from_duration(vm, ArithmeticOperation::Subtract, *duration, other, options)); @@ -326,7 +326,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::round) // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { @@ -450,7 +450,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::total) // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. If totalOf is undefined, throw a TypeError exception. if (vm.argument(0).is_undefined()) @@ -568,7 +568,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::to_string) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(vm, vm.argument(0))); @@ -595,7 +595,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::to_json) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return ! TemporalDurationToString(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]], "auto"). return js_string(vm, temporal_duration_to_string(duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds(), "auto"sv)); @@ -607,7 +607,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::to_locale_string) { // 1. Let duration be the this value. // 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). - auto* duration = TRY(typed_this_object(global_object)); + auto* duration = TRY(typed_this_object(vm)); // 3. Return ! TemporalDurationToString(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]], "auto"). return js_string(vm, temporal_duration_to_string(duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds(), "auto"sv)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp index 3ccf9a9a82..91fb163740 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp @@ -58,7 +58,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_seconds_getter) { // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Let ns be instant.[[Nanoseconds]]. auto& ns = instant->nanoseconds(); @@ -75,7 +75,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_milliseconds_getter) { // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Let ns be instant.[[Nanoseconds]]. auto& ns = instant->nanoseconds(); @@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_microseconds_getter) { // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Let ns be instant.[[Nanoseconds]]. auto& ns = instant->nanoseconds(); @@ -109,7 +109,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_nanoseconds_getter) { // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Let ns be instant.[[Nanoseconds]]. auto& ns = instant->nanoseconds(); @@ -125,7 +125,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::add) // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromInstant(add, instant, temporalDurationLike). return TRY(add_duration_to_or_subtract_duration_from_instant(vm, ArithmeticOperation::Add, *instant, temporal_duration_like)); @@ -138,7 +138,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::subtract) // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromInstant(subtract, instant, temporalDurationLike). return TRY(add_duration_to_or_subtract_duration_from_instant(vm, ArithmeticOperation::Subtract, *instant, temporal_duration_like)); @@ -152,7 +152,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::until) // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalInstant(until, instant, other, options). return TRY(difference_temporal_instant(vm, DifferenceOperation::Until, *instant, other, options)); @@ -166,7 +166,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::since) // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalInstant(since, instant, other, options). return TRY(difference_temporal_instant(vm, DifferenceOperation::Since, *instant, other, options)); @@ -179,7 +179,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::round) // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { @@ -267,7 +267,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::equals) { // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Set other to ? ToTemporalInstant(other). auto other = TRY(to_temporal_instant(vm, vm.argument(0))); @@ -285,7 +285,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_string) { // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(vm, vm.argument(0))); @@ -321,7 +321,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_locale_string) { // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Return ? TemporalInstantToString(instant, undefined, "auto"). return js_string(vm, TRY(temporal_instant_to_string(vm, *instant, js_undefined(), "auto"sv))); @@ -332,7 +332,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_json) { // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. Return ? TemporalInstantToString(instant, undefined, "auto"). return js_string(vm, TRY(temporal_instant_to_string(vm, *instant, js_undefined(), "auto"sv))); @@ -352,7 +352,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time) // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. If Type(item) is not Object, then if (!item.is_object()) { @@ -395,7 +395,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time_iso) // 1. Let instant be the this value. // 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]). - auto* instant = TRY(typed_this_object(global_object)); + auto* instant = TRY(typed_this_object(vm)); // 3. If Type(item) is Object, then if (item.is_object()) { diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp index f02539880c..81a87bea6f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -74,7 +74,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::calendar_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Return temporalDate.[[Calendar]]. return Value(&temporal_date->calendar()); @@ -85,7 +85,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::year_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -99,7 +99,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::month_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -113,7 +113,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::month_code_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -127,7 +127,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -141,7 +141,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_of_week_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -155,7 +155,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_of_year_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -169,7 +169,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::week_of_year_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -183,7 +183,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_week_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -197,7 +197,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_month_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -211,7 +211,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_year_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -225,7 +225,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::months_in_year_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -239,7 +239,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::in_leap_year_getter) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -253,7 +253,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::era_getter) { // 1. Let plainDate be the this value. // 2. Perform ? RequireInternalSlot(plainDate, [[InitializedTemporalDate]]). - auto* plain_date = TRY(typed_this_object(global_object)); + auto* plain_date = TRY(typed_this_object(vm)); // 3. Let calendar be plainDate.[[Calendar]]. auto& calendar = plain_date->calendar(); @@ -267,7 +267,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::era_year_getter) { // 1. Let plainDate be the this value. // 2. Perform ? RequireInternalSlot(plainDate, [[InitializedTemporalDate]]). - auto* plain_date = TRY(typed_this_object(global_object)); + auto* plain_date = TRY(typed_this_object(vm)); // 3. Let calendar be plainDate.[[Calendar]]. auto& calendar = plain_date->calendar(); @@ -281,7 +281,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_year_month) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -301,7 +301,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_month_day) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be temporalDate.[[Calendar]]. auto& calendar = temporal_date->calendar(); @@ -323,7 +323,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::get_iso_fields) // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let fields be OrdinaryObjectCreate(%Object.prototype%). auto* fields = Object::create(realm, global_object.object_prototype()); @@ -349,7 +349,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::add) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let duration be ? ToTemporalDuration(temporalDurationLike). auto* duration = TRY(to_temporal_duration(vm, vm.argument(0))); @@ -366,7 +366,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::subtract) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let duration be ? ToTemporalDuration(temporalDurationLike). auto* duration = TRY(to_temporal_duration(vm, vm.argument(0))); @@ -388,7 +388,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::with) // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. If Type(temporalDateLike) is not Object, then if (!temporal_date_like.is_object()) { @@ -431,7 +431,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::with_calendar) // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Let calendar be ? ToTemporalCalendar(calendarLike). auto* calendar = TRY(to_temporal_calendar(vm, calendar_like)); @@ -448,7 +448,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::until) // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalPlainDate(until, temporalDate, other, options). return TRY(difference_temporal_plain_date(vm, DifferenceOperation::Until, *temporal_date, other, options)); @@ -462,7 +462,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::since) // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalPlainDate(since, temporalDate, other, options). return TRY(difference_temporal_plain_date(vm, DifferenceOperation::Since, *temporal_date, other, options)); @@ -473,7 +473,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::equals) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Set other to ? ToTemporalDate(other). auto* other = TRY(to_temporal_date(vm, vm.argument(0))); @@ -496,7 +496,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_date_time) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. If temporalTime is undefined, then if (vm.argument(0).is_undefined()) { @@ -518,7 +518,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_zoned_date_time) // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); auto temporal_time_value = js_undefined(); Object* time_zone; @@ -580,7 +580,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_string) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Set options to ? GetOptionsObject(options). auto* options = TRY(get_options_object(vm, vm.argument(0))); @@ -598,7 +598,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_locale_string) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Return ? TemporalDateToString(temporalDate, "auto"). return js_string(vm, TRY(temporal_date_to_string(vm, *temporal_date, "auto"sv))); @@ -609,7 +609,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_json) { // 1. Let temporalDate be the this value. // 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]). - auto* temporal_date = TRY(typed_this_object(global_object)); + auto* temporal_date = TRY(typed_this_object(vm)); // 3. Return ? TemporalDateToString(temporalDate, "auto"). return js_string(vm, TRY(temporal_date_to_string(vm, *temporal_date, "auto"sv))); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index 1fbb781941..b7c4181442 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -85,7 +85,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::calendar_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return dateTime.[[Calendar]]. return Value(&date_time->calendar()); @@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::year_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -110,7 +110,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -124,7 +124,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_code_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -138,7 +138,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -152,7 +152,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::hour_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(dateTime.[[ISOHour]]). return Value(date_time->iso_hour()); @@ -163,7 +163,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::minute_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(dateTime.[[ISOMinute]]). return Value(date_time->iso_minute()); @@ -174,7 +174,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::second_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(dateTime.[[ISOSecond]]). return Value(date_time->iso_second()); @@ -185,7 +185,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::millisecond_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(dateTime.[[ISOMillisecond]]). return Value(date_time->iso_millisecond()); @@ -196,7 +196,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::microsecond_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(dateTime.[[ISOMicrosecond]]). return Value(date_time->iso_microsecond()); @@ -207,7 +207,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::nanosecond_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(dateTime.[[ISONanosecond]]). return Value(date_time->iso_nanosecond()); @@ -218,7 +218,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_week_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -232,7 +232,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_year_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -246,7 +246,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::week_of_year_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -260,7 +260,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_week_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -274,7 +274,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_month_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -288,7 +288,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_year_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -302,7 +302,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::months_in_year_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -316,7 +316,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::in_leap_year_getter) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -330,7 +330,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::era_getter) { // 1. Let plainDateTime be the this value. // 2. Perform ? RequireInternalSlot(plainDateTime, [[InitializedTemporalDateTime]]). - auto* plain_date_time = TRY(typed_this_object(global_object)); + auto* plain_date_time = TRY(typed_this_object(vm)); // 3. Let calendar be plainDateTime.[[Calendar]]. auto& calendar = plain_date_time->calendar(); @@ -344,7 +344,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::era_year_getter) { // 1. Let plainDateTime be the this value. // 2. Perform ? RequireInternalSlot(plainDateTime, [[InitializedTemporalDateTime]]). - auto* plain_date_time = TRY(typed_this_object(global_object)); + auto* plain_date_time = TRY(typed_this_object(vm)); // 3. Let calendar be plainDateTime.[[Calendar]]. auto& calendar = plain_date_time->calendar(); @@ -360,7 +360,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with) // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. If Type(temporalDateTimeLike) is not Object, then if (!temporal_date_time_like.is_object()) { @@ -410,7 +410,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_time) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. If plainTimeLike is undefined, then if (vm.argument(0).is_undefined()) { @@ -430,7 +430,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_date) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let plainDate be ? ToTemporalDate(plainDateLike). auto* plain_date = TRY(to_temporal_date(vm, vm.argument(0))); @@ -449,7 +449,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_calendar) // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be ? ToTemporalCalendar(calendarLike). auto* calendar = TRY(to_temporal_calendar(vm, calendar_like)); @@ -466,7 +466,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::add) // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromPlainDateTime(add, dateTime, temporalDurationLike, options). return TRY(add_duration_to_or_subtract_duration_from_plain_date_time(vm, ArithmeticOperation::Add, *date_time, temporal_duration_like, options)); @@ -480,7 +480,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::subtract) // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromPlainDateTime(subtract, dateTime, temporalDurationLike, options). return TRY(add_duration_to_or_subtract_duration_from_plain_date_time(vm, ArithmeticOperation::Subtract, *date_time, temporal_duration_like, options)); @@ -494,7 +494,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::until) // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalPlainDateTime(until, dateTime, other, options). return TRY(difference_temporal_plain_date_time(vm, DifferenceOperation::Until, *date_time, other, options)); @@ -508,7 +508,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::since) // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalPlainDateTime(since, dateTime, other, options). return TRY(difference_temporal_plain_date_time(vm, DifferenceOperation::Since, *date_time, other, options)); @@ -521,7 +521,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::round) // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { @@ -568,7 +568,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::equals) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Set other to ? ToTemporalDateTime(other). auto* other = TRY(to_temporal_date_time(vm, vm.argument(0))); @@ -589,7 +589,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_string) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Set options to ? GetOptionsObject(options). auto* options = TRY(get_options_object(vm, vm.argument(0))); @@ -616,7 +616,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_locale_string) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return ? TemporalDateTimeToString(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]], dateTime.[[Calendar]], "auto", "auto"). return js_string(vm, TRY(temporal_date_time_to_string(vm, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), &date_time->calendar(), "auto"sv, "auto"sv))); @@ -627,7 +627,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_json) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return ? TemporalDateTimeToString(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]], dateTime.[[Calendar]], "auto", "auto"). return js_string(vm, TRY(temporal_date_time_to_string(vm, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), &date_time->calendar(), "auto"sv, "auto"sv))); @@ -645,7 +645,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_zoned_date_time) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be ? ToTemporalTimeZone(temporalTimeZoneLike). auto* time_zone = TRY(to_temporal_time_zone(vm, vm.argument(0))); @@ -668,7 +668,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_date) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return ! CreateTemporalDate(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[Calendar]]). return MUST(create_temporal_date(vm, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->calendar())); @@ -679,7 +679,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_year_month) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -699,7 +699,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_month_day) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let calendar be dateTime.[[Calendar]]. auto& calendar = date_time->calendar(); @@ -719,7 +719,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_time) { // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Return ! CreateTemporalTime(dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]]). return MUST(create_temporal_time(vm, date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond())); @@ -732,7 +732,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::get_iso_fields) // 1. Let dateTime be the this value. // 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]). - auto* date_time = TRY(typed_this_object(global_object)); + auto* date_time = TRY(typed_this_object(vm)); // 3. Let fields be OrdinaryObjectCreate(%Object.prototype%). auto* fields = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp index 34cb5ec9ba..15ea5be926 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -49,7 +49,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::calendar_getter) { // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. Return monthDay.[[Calendar]]. return Value(&month_day->calendar()); @@ -60,7 +60,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::month_code_getter) { // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. Let calendar be monthDay.[[Calendar]]. auto& calendar = month_day->calendar(); @@ -74,7 +74,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::day_getter) { // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. Let calendar be monthDay.[[Calendar]]. auto& calendar = month_day->calendar(); @@ -90,7 +90,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::with) // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. If Type(temporalMonthDayLike) is not Object, then if (!temporal_month_day_like.is_object()) { @@ -131,7 +131,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::equals) { // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. Set other to ? ToTemporalMonthDay(other). auto* other = TRY(to_temporal_month_day(vm, vm.argument(0))); @@ -157,7 +157,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_string) { // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. Set options to ? GetOptionsObject(options). auto* options = TRY(get_options_object(vm, vm.argument(0))); @@ -175,7 +175,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_locale_string) { // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. Return ? TemporalMonthDayToString(monthDay, "auto"). return js_string(vm, TRY(temporal_month_day_to_string(vm, *month_day, "auto"sv))); @@ -186,7 +186,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_json) { // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. Return ? TemporalMonthDayToString(monthDay, "auto"). return js_string(vm, TRY(temporal_month_day_to_string(vm, *month_day, "auto"sv))); @@ -208,7 +208,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_plain_date) // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. If Type(item) is not Object, then if (!item.is_object()) { @@ -257,7 +257,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::get_iso_fields) // 1. Let monthDay be the this value. // 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). - auto* month_day = TRY(typed_this_object(global_object)); + auto* month_day = TRY(typed_this_object(vm)); // 3. Let fields be OrdinaryObjectCreate(%Object.prototype%). auto* fields = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp index 84776608d6..2859756bb6 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp @@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::calendar_getter) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return temporalTime.[[Calendar]]. return Value(&temporal_time->calendar()); @@ -75,7 +75,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::hour_getter) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(temporalTime.[[ISOHour]]). return Value(temporal_time->iso_hour()); @@ -86,7 +86,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::minute_getter) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(temporalTime.[[ISOMinute]]). return Value(temporal_time->iso_minute()); @@ -97,7 +97,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::second_getter) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(temporalTime.[[ISOSecond]]). return Value(temporal_time->iso_second()); @@ -108,7 +108,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::millisecond_getter) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(temporalTime.[[ISOMillisecond]]). return Value(temporal_time->iso_millisecond()); @@ -119,7 +119,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::microsecond_getter) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(temporalTime.[[ISOMicrosecond]]). return Value(temporal_time->iso_microsecond()); @@ -130,7 +130,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::nanosecond_getter) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return 𝔽(temporalTime.[[ISONanosecond]]). return Value(temporal_time->iso_nanosecond()); @@ -143,7 +143,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::add) // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromPlainTime(add, temporalTime, temporalDurationLike). return TRY(add_duration_to_or_subtract_duration_from_plain_time(vm, ArithmeticOperation::Add, *temporal_time, temporal_duration_like)); @@ -156,7 +156,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::subtract) // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromPlainTime(subtract, temporalTime, temporalDurationLike). return TRY(add_duration_to_or_subtract_duration_from_plain_time(vm, ArithmeticOperation::Subtract, *temporal_time, temporal_duration_like)); @@ -167,7 +167,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::with) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); auto temporal_time_like_argument = vm.argument(0); @@ -242,7 +242,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::until) // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalPlainTime(until, temporalTime, other, options). return TRY(difference_temporal_plain_time(vm, DifferenceOperation::Until, *temporal_time, other, options)); @@ -256,7 +256,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::since) // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalPlainTime(since, temporalTime, other, options). return TRY(difference_temporal_plain_time(vm, DifferenceOperation::Since, *temporal_time, other, options)); @@ -269,7 +269,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::round) // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { @@ -319,7 +319,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::equals) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Set other to ? ToTemporalTime(other). auto* other = TRY(to_temporal_time(vm, vm.argument(0))); @@ -357,7 +357,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_plain_date_time) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Set temporalDate to ? ToTemporalDate(temporalDate). auto* temporal_date = TRY(to_temporal_date(vm, vm.argument(0))); @@ -373,7 +373,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_zoned_date_time) // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. If Type(item) is not Object, then if (!item.is_object()) { @@ -422,7 +422,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::get_iso_fields) // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Let fields be OrdinaryObjectCreate(%Object.prototype%). auto* fields = Object::create(realm, global_object.object_prototype()); @@ -457,7 +457,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_string) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Set options to ? GetOptionsObject(options). auto* options = TRY(get_options_object(vm, vm.argument(0))); @@ -481,7 +481,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_locale_string) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return ! TemporalTimeToString(temporalTime.[[ISOHour]], temporalTime.[[ISOMinute]], temporalTime.[[ISOSecond]], temporalTime.[[ISOMillisecond]], temporalTime.[[ISOMicrosecond]], temporalTime.[[ISONanosecond]], "auto"). auto string = temporal_time_to_string(temporal_time->iso_hour(), temporal_time->iso_minute(), temporal_time->iso_second(), temporal_time->iso_millisecond(), temporal_time->iso_microsecond(), temporal_time->iso_nanosecond(), "auto"sv); @@ -493,7 +493,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_json) { // 1. Let temporalTime be the this value. // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). - auto* temporal_time = TRY(typed_this_object(global_object)); + auto* temporal_time = TRY(typed_this_object(vm)); // 3. Return ! TemporalTimeToString(temporalTime.[[ISOHour]], temporalTime.[[ISOMinute]], temporalTime.[[ISOSecond]], temporalTime.[[ISOMillisecond]], temporalTime.[[ISOMicrosecond]], temporalTime.[[ISONanosecond]], "auto"). auto string = temporal_time_to_string(temporal_time->iso_hour(), temporal_time->iso_minute(), temporal_time->iso_second(), temporal_time->iso_millisecond(), temporal_time->iso_microsecond(), temporal_time->iso_nanosecond(), "auto"sv); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp index b62467064e..fe5bf5526e 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -62,7 +62,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::calendar_getter) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Return yearMonth.[[Calendar]]. return Value(&year_month->calendar()); @@ -73,7 +73,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::year_getter) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Let calendar be yearMonth.[[Calendar]]. auto& calendar = year_month->calendar(); @@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::month_getter) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Let calendar be yearMonth.[[Calendar]]. auto& calendar = year_month->calendar(); @@ -101,7 +101,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::month_code_getter) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Let calendar be yearMonth.[[Calendar]]. auto& calendar = year_month->calendar(); @@ -115,7 +115,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::days_in_year_getter) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Let calendar be yearMonth.[[Calendar]]. auto& calendar = year_month->calendar(); @@ -129,7 +129,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::days_in_month_getter) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Let calendar be yearMonth.[[Calendar]]. auto& calendar = year_month->calendar(); @@ -143,7 +143,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::months_in_year_getter) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Let calendar be yearMonth.[[Calendar]]. auto& calendar = year_month->calendar(); @@ -157,7 +157,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::in_leap_year_getter) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Let calendar be yearMonth.[[Calendar]]. auto& calendar = year_month->calendar(); @@ -171,7 +171,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::era_getter) { // 1. Let plainYearMonth be the this value. // 2. Perform ? RequireInternalSlot(plainYearMonth, [[InitializedTemporalYearMonth]]). - auto* plain_year_month = TRY(typed_this_object(global_object)); + auto* plain_year_month = TRY(typed_this_object(vm)); // 3. Let calendar be plainYearMonth.[[Calendar]]. auto& calendar = plain_year_month->calendar(); @@ -185,7 +185,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::era_year_getter) { // 1. Let plainYearMonth be the this value. // 2. Perform ? RequireInternalSlot(plainYearMonth, [[InitializedTemporalYearMonth]]). - auto* plain_year_month = TRY(typed_this_object(global_object)); + auto* plain_year_month = TRY(typed_this_object(vm)); // 3. Let calendar be plainYearMonth.[[Calendar]]. auto& calendar = plain_year_month->calendar(); @@ -201,7 +201,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::with) // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. If Type(temporalYearMonthLike) is not Object, then if (!temporal_year_month_like.is_object()) { @@ -245,7 +245,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::add) // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromPlainYearMonth(add, yearMonth, temporalDurationLike, options). return TRY(add_duration_to_or_subtract_duration_from_plain_year_month(vm, ArithmeticOperation::Add, *year_month, temporal_duration_like, options)); @@ -259,7 +259,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::subtract) // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromPlainYearMonth(add, yearMonth, temporalDurationLike, options). return TRY(add_duration_to_or_subtract_duration_from_plain_year_month(vm, ArithmeticOperation::Subtract, *year_month, temporal_duration_like, options)); @@ -273,7 +273,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::until) // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalPlainYearMonth(until, yearMonth, other, options). return TRY(difference_temporal_plain_year_month(vm, DifferenceOperation::Until, *year_month, other, options)); @@ -287,7 +287,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::since) // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalPlainYearMonth(since, yearMonth, other, options). return TRY(difference_temporal_plain_year_month(vm, DifferenceOperation::Since, *year_month, other, options)); @@ -298,7 +298,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::equals) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Set other to ? ToTemporalYearMonth(other). auto* other = TRY(to_temporal_year_month(vm, vm.argument(0))); @@ -324,7 +324,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_string) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Set options to ? GetOptionsObject(options). auto* options = TRY(get_options_object(vm, vm.argument(0))); @@ -342,7 +342,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_locale_string) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Return ? TemporalYearMonthToString(yearMonth, "auto"). return js_string(vm, TRY(temporal_year_month_to_string(vm, *year_month, "auto"sv))); @@ -353,7 +353,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_json) { // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Return ? TemporalYearMonthToString(yearMonth, "auto"). return js_string(vm, TRY(temporal_year_month_to_string(vm, *year_month, "auto"sv))); @@ -375,7 +375,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_plain_date) // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. If Type(item) is not Object, then if (!item.is_object()) { @@ -424,7 +424,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::get_iso_fields) // 1. Let yearMonth be the this value. // 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). - auto* year_month = TRY(typed_this_object(global_object)); + auto* year_month = TRY(typed_this_object(vm)); // 3. Let fields be OrdinaryObjectCreate(%Object.prototype%). auto* fields = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp index 5cf7a6629d..e136b00a0f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp @@ -49,7 +49,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::id_getter) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Return ? ToString(timeZone). return js_string(vm, TRY(Value(time_zone).to_string(global_object))); @@ -60,7 +60,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_offset_nanoseconds_for) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Set instant to ? ToTemporalInstant(instant). auto* instant = TRY(to_temporal_instant(vm, vm.argument(0))); @@ -78,7 +78,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_offset_string_for) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Set instant to ? ToTemporalInstant(instant). auto* instant = TRY(to_temporal_instant(vm, vm.argument(0))); @@ -93,7 +93,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_plain_date_time_for) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Set instant to ? ToTemporalInstant(instant). auto* instant = TRY(to_temporal_instant(vm, vm.argument(0))); @@ -110,7 +110,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_instant_for) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Set dateTime to ? ToTemporalDateTime(dateTime). auto* date_time = TRY(to_temporal_date_time(vm, vm.argument(0))); @@ -132,7 +132,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_possible_instants_for) // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimezone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Set dateTime to ? ToTemporalDateTime(dateTime). auto* date_time = TRY(to_temporal_date_time(vm, vm.argument(0))); @@ -179,7 +179,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_next_transition) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Set startingPoint to ? ToTemporalInstant(startingPoint). auto* starting_point = TRY(to_temporal_instant(vm, vm.argument(0))); @@ -204,7 +204,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_previous_transition) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Set startingPoint to ? ToTemporalInstant(startingPoint). auto* starting_point = TRY(to_temporal_instant(vm, vm.argument(0))); @@ -229,7 +229,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::to_string) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Return timeZone.[[Identifier]]. return js_string(vm, time_zone->identifier()); @@ -240,7 +240,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::to_json) { // 1. Let timeZone be the this value. // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]). - auto* time_zone = TRY(typed_this_object(global_object)); + auto* time_zone = TRY(typed_this_object(vm)); // 3. Return ? ToString(timeZone). return js_string(vm, TRY(Value(time_zone).to_string(global_object))); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index 9d685bb7f1..f55e8871d2 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -95,7 +95,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::calendar_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return zonedDateTime.[[Calendar]]. return Value(&zoned_date_time->calendar()); @@ -106,7 +106,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::time_zone_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return zonedDateTime.[[TimeZone]]. return Value(&zoned_date_time->time_zone()); @@ -117,7 +117,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::year_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -140,7 +140,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::month_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -163,7 +163,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::month_code_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -186,7 +186,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -209,7 +209,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::hour_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -232,7 +232,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::minute_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -255,7 +255,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::second_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -278,7 +278,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::millisecond_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -301,7 +301,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::microsecond_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -324,7 +324,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::nanosecond_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -347,7 +347,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_seconds_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let ns be zonedDateTime.[[Nanoseconds]]. auto& ns = zoned_date_time->nanoseconds(); @@ -364,7 +364,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_milliseconds_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let ns be zonedDateTime.[[Nanoseconds]]. auto& ns = zoned_date_time->nanoseconds(); @@ -381,7 +381,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_microseconds_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let ns be zonedDateTime.[[Nanoseconds]]. auto& ns = zoned_date_time->nanoseconds(); @@ -398,7 +398,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_nanoseconds_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return zonedDateTime.[[Nanoseconds]]. return &zoned_date_time->nanoseconds(); @@ -409,7 +409,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_of_week_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -432,7 +432,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_of_year_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -455,7 +455,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::week_of_year_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -478,7 +478,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::hours_in_day_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -529,7 +529,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_week_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -552,7 +552,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_month_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -575,7 +575,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_year_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -598,7 +598,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::months_in_year_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -621,7 +621,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::in_leap_year_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -644,7 +644,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::offset_nanoseconds_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -661,7 +661,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::offset_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let instant be ! CreateTemporalInstant(zonedDateTime.[[Nanoseconds]]). auto* instant = MUST(create_temporal_instant(vm, zoned_date_time->nanoseconds())); @@ -676,7 +676,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::era_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -699,7 +699,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::era_year_getter) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -724,7 +724,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with) // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. If Type(temporalZonedDateTimeLike) is not Object, then if (!temporal_zoned_date_time_like.is_object()) { @@ -795,7 +795,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with_plain_time) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); PlainTime* plain_time = nullptr; @@ -837,7 +837,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with_plain_date) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let plainDate be ? ToTemporalDate(plainDateLike). auto* plain_date = TRY(to_temporal_date(vm, vm.argument(0))); @@ -869,7 +869,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with_time_zone) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be ? ToTemporalTimeZone(timeZoneLike). auto* time_zone = TRY(to_temporal_time_zone(vm, vm.argument(0))); @@ -883,7 +883,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with_calendar) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let calendar be ? ToTemporalCalendar(calendarLike). auto* calendar = TRY(to_temporal_calendar(vm, vm.argument(0))); @@ -900,7 +900,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::add) // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromZonedDateTime(add, zonedDateTime, temporalDurationLike, options). return TRY(add_duration_to_or_subtract_duration_from_zoned_date_time(vm, ArithmeticOperation::Add, *zoned_date_time, temporal_duration_like, options)); @@ -914,7 +914,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::subtract) // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return ? AddDurationToOrSubtractDurationFromZonedDateTime(subtract, zonedDateTime, temporalDurationLike, options). return TRY(add_duration_to_or_subtract_duration_from_zoned_date_time(vm, ArithmeticOperation::Subtract, *zoned_date_time, temporal_duration_like, options)); @@ -928,7 +928,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::until) // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalZonedDateTime(until, zonedDateTime, other, options). return TRY(difference_temporal_zoned_date_time(vm, DifferenceOperation::Until, *zoned_date_time, other, options)); @@ -942,7 +942,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::since) // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return ? DifferenceTemporalZonedDateTime(since, zonedDateTime, other, options). return TRY(difference_temporal_zoned_date_time(vm, DifferenceOperation::Since, *zoned_date_time, other, options)); @@ -955,7 +955,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::round) // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { @@ -1044,7 +1044,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::equals) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Set other to ? ToTemporalZonedDateTime(other). auto* other = TRY(to_temporal_zoned_date_time(vm, vm.argument(0))); @@ -1066,7 +1066,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_string) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Set options to ? GetOptionsObject(options). auto* options = TRY(get_options_object(vm, vm.argument(0))); @@ -1096,7 +1096,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_locale_string) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return ? TemporalZonedDateTimeToString(zonedDateTime, "auto", "auto", "auto", "auto"). return js_string(vm, TRY(temporal_zoned_date_time_to_string(vm, *zoned_date_time, "auto"sv, "auto"sv, "auto"sv, "auto"sv))); @@ -1107,7 +1107,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_json) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return ? TemporalZonedDateTimeToString(zonedDateTime, "auto", "auto", "auto", "auto"). return js_string(vm, TRY(temporal_zoned_date_time_to_string(vm, *zoned_date_time, "auto"sv, "auto"sv, "auto"sv, "auto"sv))); @@ -1125,7 +1125,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::start_of_day) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -1154,7 +1154,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_instant) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Return ! CreateTemporalInstant(zonedDateTime.[[Nanoseconds]]). return MUST(create_temporal_instant(vm, zoned_date_time->nanoseconds())); @@ -1165,7 +1165,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_date) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -1188,7 +1188,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_time) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -1211,7 +1211,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_date_time) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -1228,7 +1228,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_year_month) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -1257,7 +1257,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_month_day) { // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let timeZone be zonedDateTime.[[TimeZone]]. auto& time_zone = zoned_date_time->time_zone(); @@ -1288,7 +1288,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::get_iso_fields) // 1. Let zonedDateTime be the this value. // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). - auto* zoned_date_time = TRY(typed_this_object(global_object)); + auto* zoned_date_time = TRY(typed_this_object(vm)); // 3. Let fields be OrdinaryObjectCreate(%Object.prototype%). auto* fields = Object::create(realm, global_object.object_prototype()); diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp index ce8004e230..539807fca1 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp @@ -34,7 +34,7 @@ void WeakMapPrototype::initialize(Realm& realm) // 24.3.3.2 WeakMap.prototype.delete ( key ), https://tc39.es/ecma262/#sec-weakmap.prototype.delete JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::delete_) { - auto* weak_map = TRY(typed_this_object(global_object)); + auto* weak_map = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) return Value(false); @@ -44,7 +44,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::delete_) // 24.3.3.3 WeakMap.prototype.get ( key ), https://tc39.es/ecma262/#sec-weakmap.prototype.get JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::get) { - auto* weak_map = TRY(typed_this_object(global_object)); + auto* weak_map = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) return js_undefined(); @@ -58,7 +58,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::get) // 24.3.3.4 WeakMap.prototype.has ( key ), https://tc39.es/ecma262/#sec-weakmap.prototype.has JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::has) { - auto* weak_map = TRY(typed_this_object(global_object)); + auto* weak_map = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) return Value(false); @@ -69,7 +69,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::has) // 24.3.3.5 WeakMap.prototype.set ( key, value ), https://tc39.es/ecma262/#sec-weakmap.prototype.set JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::set) { - auto* weak_map = TRY(typed_this_object(global_object)); + auto* weak_map = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) return vm.throw_completion(ErrorType::CannotBeHeldWeakly, value.to_string_without_side_effects()); diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp index d0c00f8eba..d282d4a07a 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp @@ -27,7 +27,7 @@ void WeakRefPrototype::initialize(Realm& realm) // 26.1.3.2 WeakRef.prototype.deref ( ), https://tc39.es/ecma262/#sec-weak-ref.prototype.deref JS_DEFINE_NATIVE_FUNCTION(WeakRefPrototype::deref) { - auto* weak_ref = TRY(typed_this_object(global_object)); + auto* weak_ref = TRY(typed_this_object(vm)); weak_ref->update_execution_generation(); return weak_ref->value().visit( diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp index 0fe40d74b1..9040447d7a 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp @@ -33,7 +33,7 @@ void WeakSetPrototype::initialize(Realm& realm) // 24.4.3.1 WeakSet.prototype.add ( value ), https://tc39.es/ecma262/#sec-weakset.prototype.add JS_DEFINE_NATIVE_FUNCTION(WeakSetPrototype::add) { - auto* weak_set = TRY(typed_this_object(global_object)); + auto* weak_set = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) return vm.throw_completion(ErrorType::CannotBeHeldWeakly, value.to_string_without_side_effects()); @@ -44,7 +44,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakSetPrototype::add) // 24.4.3.3 WeakSet.prototype.delete ( value ), https://tc39.es/ecma262/#sec-weakset.prototype.delete JS_DEFINE_NATIVE_FUNCTION(WeakSetPrototype::delete_) { - auto* weak_set = TRY(typed_this_object(global_object)); + auto* weak_set = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) return Value(false); @@ -54,7 +54,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakSetPrototype::delete_) // 24.4.3.4 WeakSet.prototype.has ( value ), https://tc39.es/ecma262/#sec-weakset.prototype.has JS_DEFINE_NATIVE_FUNCTION(WeakSetPrototype::has) { - auto* weak_set = TRY(typed_this_object(global_object)); + auto* weak_set = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) return Value(false); diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp index bc9c15c256..4ee673ea5c 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -73,9 +73,8 @@ AK::URL LocationObject::url() const return relevant_document ? relevant_document->url() : "about:blank"sv; } -static JS::ThrowCompletionOr typed_this_value(JS::GlobalObject& global_object) +static JS::ThrowCompletionOr typed_this_value(JS::VM& vm) { - auto& vm = global_object.vm(); auto this_value = vm.this_value(); if (!this_value.is_object() || !is(this_value.as_object())) return vm.throw_completion(JS::ErrorType::NotAnObjectOfType, "Location"); @@ -85,7 +84,7 @@ static JS::ThrowCompletionOr typed_this_value(JS::GlobalObject& // https://html.spec.whatwg.org/multipage/history.html#dom-location-href JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_getter) { - auto* location_object = TRY(typed_this_value(global_object)); + auto* location_object = TRY(typed_this_value(vm)); // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException. @@ -115,7 +114,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_setter) // https://html.spec.whatwg.org/multipage/history.html#dom-location-pathname JS_DEFINE_NATIVE_FUNCTION(LocationObject::pathname_getter) { - auto* location_object = TRY(typed_this_value(global_object)); + auto* location_object = TRY(typed_this_value(vm)); // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException. @@ -126,7 +125,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::pathname_getter) // https://html.spec.whatwg.org/multipage/history.html#dom-location-hostname JS_DEFINE_NATIVE_FUNCTION(LocationObject::hostname_getter) { - auto* location_object = TRY(typed_this_value(global_object)); + auto* location_object = TRY(typed_this_value(vm)); // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException. @@ -141,7 +140,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::hostname_getter) // https://html.spec.whatwg.org/multipage/history.html#dom-location-host JS_DEFINE_NATIVE_FUNCTION(LocationObject::host_getter) { - auto* location_object = TRY(typed_this_value(global_object)); + auto* location_object = TRY(typed_this_value(vm)); // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException. @@ -163,7 +162,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::host_getter) // https://html.spec.whatwg.org/multipage/history.html#dom-location-hash JS_DEFINE_NATIVE_FUNCTION(LocationObject::hash_getter) { - auto* location_object = TRY(typed_this_value(global_object)); + auto* location_object = TRY(typed_this_value(vm)); // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException. @@ -178,7 +177,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::hash_getter) // https://html.spec.whatwg.org/multipage/history.html#dom-location-search JS_DEFINE_NATIVE_FUNCTION(LocationObject::search_getter) { - auto* location_object = TRY(typed_this_value(global_object)); + auto* location_object = TRY(typed_this_value(vm)); // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException. @@ -193,7 +192,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::search_getter) // https://html.spec.whatwg.org/multipage/history.html#dom-location-protocol JS_DEFINE_NATIVE_FUNCTION(LocationObject::protocol_getter) { - auto* location_object = TRY(typed_this_value(global_object)); + auto* location_object = TRY(typed_this_value(vm)); // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException. @@ -204,7 +203,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::protocol_getter) // https://html.spec.whatwg.org/multipage/history.html#dom-location-port JS_DEFINE_NATIVE_FUNCTION(LocationObject::port_getter) { - auto* location_object = TRY(typed_this_value(global_object)); + auto* location_object = TRY(typed_this_value(vm)); // FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.