From 2555d7a36a1c9cbe768d2cba0f2db9f38dc00af4 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 13 Apr 2023 01:14:45 +0200 Subject: [PATCH] LibJS: Make well-known symbol getters return NonnullGCPtr None of these are ever null after the VM has been initialized, as proved by virtually every caller immediately dereferencing the raw pointer. --- .../BindingsGenerator/IDLGenerators.cpp | 14 ++++++------- .../LibJS/Runtime/AbstractOperations.cpp | 8 ++++---- .../LibJS/Runtime/ArrayBufferConstructor.cpp | 2 +- .../LibJS/Runtime/ArrayBufferPrototype.cpp | 2 +- .../LibJS/Runtime/ArrayConstructor.cpp | 4 ++-- .../LibJS/Runtime/ArrayIteratorPrototype.cpp | 2 +- .../LibJS/Runtime/ArrayPrototype.cpp | 8 ++++---- .../LibJS/Runtime/AsyncFunctionPrototype.cpp | 2 +- .../AsyncGeneratorFunctionPrototype.cpp | 2 +- .../LibJS/Runtime/AsyncGeneratorPrototype.cpp | 2 +- .../LibJS/Runtime/AsyncIteratorPrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/AtomicsObject.cpp | 2 +- .../LibJS/Runtime/BigIntPrototype.cpp | 2 +- .../LibJS/Runtime/DataViewPrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/DatePrototype.cpp | 2 +- .../Runtime/DisposableStackPrototype.cpp | 4 ++-- .../Runtime/FinalizationRegistryPrototype.cpp | 2 +- .../LibJS/Runtime/FunctionPrototype.cpp | 2 +- .../Runtime/GeneratorFunctionPrototype.cpp | 2 +- .../LibJS/Runtime/GeneratorPrototype.cpp | 2 +- .../LibJS/Runtime/Intl/CollatorPrototype.cpp | 2 +- .../Runtime/Intl/DateTimeFormatPrototype.cpp | 2 +- .../Runtime/Intl/DisplayNamesPrototype.cpp | 2 +- .../Runtime/Intl/DurationFormatPrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/Intl/Intl.cpp | 2 +- .../Runtime/Intl/ListFormatPrototype.cpp | 2 +- .../LibJS/Runtime/Intl/LocalePrototype.cpp | 2 +- .../Runtime/Intl/NumberFormatPrototype.cpp | 2 +- .../Runtime/Intl/PluralRulesPrototype.cpp | 2 +- .../Intl/RelativeTimeFormatPrototype.cpp | 2 +- .../Runtime/Intl/SegmentIteratorPrototype.cpp | 2 +- .../LibJS/Runtime/Intl/SegmenterPrototype.cpp | 2 +- .../LibJS/Runtime/Intl/SegmentsPrototype.cpp | 2 +- .../LibJS/Runtime/IteratorOperations.cpp | 8 ++++---- .../LibJS/Runtime/IteratorPrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/JSONObject.cpp | 2 +- .../LibJS/Runtime/MapConstructor.cpp | 2 +- .../LibJS/Runtime/MapIteratorPrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/MapPrototype.cpp | 4 ++-- .../Libraries/LibJS/Runtime/MathObject.cpp | 2 +- .../LibJS/Runtime/ModuleNamespaceObject.cpp | 3 ++- .../LibJS/Runtime/ObjectEnvironment.cpp | 4 ++-- .../LibJS/Runtime/ObjectPrototype.cpp | 4 ++-- .../LibJS/Runtime/PromiseConstructor.cpp | 2 +- .../LibJS/Runtime/PromisePrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/PropertyKey.h | 4 ++-- .../Libraries/LibJS/Runtime/ReflectObject.cpp | 2 +- .../LibJS/Runtime/RegExpConstructor.cpp | 2 +- .../LibJS/Runtime/RegExpPrototype.cpp | 10 +++++----- .../Runtime/RegExpStringIteratorPrototype.cpp | 2 +- .../LibJS/Runtime/SetConstructor.cpp | 2 +- .../LibJS/Runtime/SetIteratorPrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/SetPrototype.cpp | 4 ++-- .../LibJS/Runtime/ShadowRealmPrototype.cpp | 2 +- .../LibJS/Runtime/StringIteratorPrototype.cpp | 2 +- .../LibJS/Runtime/StringPrototype.cpp | 20 +++++++++---------- .../LibJS/Runtime/SymbolPrototype.cpp | 4 ++-- .../Runtime/Temporal/CalendarPrototype.cpp | 2 +- .../Runtime/Temporal/DurationPrototype.cpp | 2 +- .../Runtime/Temporal/InstantPrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/Temporal/Now.cpp | 2 +- .../Runtime/Temporal/PlainDatePrototype.cpp | 2 +- .../Temporal/PlainDateTimePrototype.cpp | 2 +- .../Temporal/PlainMonthDayPrototype.cpp | 2 +- .../Runtime/Temporal/PlainTimePrototype.cpp | 2 +- .../Temporal/PlainYearMonthPrototype.cpp | 2 +- .../LibJS/Runtime/Temporal/Temporal.cpp | 2 +- .../Runtime/Temporal/TimeZonePrototype.cpp | 2 +- .../Temporal/ZonedDateTimePrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/TypedArray.cpp | 2 +- .../LibJS/Runtime/TypedArrayConstructor.cpp | 4 ++-- .../LibJS/Runtime/TypedArrayPrototype.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/VM.h | 8 ++++---- Userland/Libraries/LibJS/Runtime/Value.cpp | 6 +++--- .../LibJS/Runtime/WeakMapPrototype.cpp | 2 +- .../LibJS/Runtime/WeakRefPrototype.cpp | 2 +- .../LibJS/Runtime/WeakSetPrototype.cpp | 2 +- .../CustomElements/CustomElementRegistry.cpp | 2 +- 78 files changed, 122 insertions(+), 121 deletions(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 073fbee598..97991d4ff4 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -887,7 +887,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter if (!@js_name@@js_suffix@.is_object()) return vm.throw_completion(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects())); - auto* iterator_method@recursion_depth@ = TRY(@js_name@@js_suffix@.get_method(vm, *vm.well_known_symbol_iterator())); + auto* iterator_method@recursion_depth@ = TRY(@js_name@@js_suffix@.get_method(vm, vm.well_known_symbol_iterator())); if (!iterator_method@recursion_depth@) return vm.throw_completion(JS::ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects())); )~~~"); @@ -1169,7 +1169,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter if (sequence_type) { // 1. Let method be ? GetMethod(V, @@iterator). union_generator.append(R"~~~( - auto* method = TRY(@js_name@@js_suffix@.get_method(vm, *vm.well_known_symbol_iterator())); + auto* method = TRY(@js_name@@js_suffix@.get_method(vm, vm.well_known_symbol_iterator())); )~~~"); // 2. If method is not undefined, return the result of creating a sequence of that type from V and method. @@ -2602,7 +2602,7 @@ JS::ThrowCompletionOr @class_name@::initialize(JS::Realm& realm) if (interface.indexed_property_getter.has_value()) { auto iterator_generator = generator.fork(); iterator_generator.append(R"~~~( - define_direct_property(*vm.well_known_symbol_iterator(), realm.intrinsics().array_prototype()->get_without_side_effects(vm.names.values), JS::Attribute::Configurable | JS::Attribute::Writable); + define_direct_property(vm.well_known_symbol_iterator(), realm.intrinsics().array_prototype()->get_without_side_effects(vm.names.values), JS::Attribute::Configurable | JS::Attribute::Writable); )~~~"); if (interface.value_iterator_type.has_value()) { @@ -2625,18 +2625,18 @@ JS::ThrowCompletionOr @class_name@::initialize(JS::Realm& realm) define_native_function(realm, vm.names.keys, keys, 0, default_attributes); define_native_function(realm, vm.names.values, values, 0, default_attributes); - define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.entries), JS::Attribute::Configurable | JS::Attribute::Writable); + define_direct_property(vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.entries), JS::Attribute::Configurable | JS::Attribute::Writable); )~~~"); } if (interface.has_unscopable_member) { generator.append(R"~~~( - define_direct_property(*vm.well_known_symbol_unscopables(), unscopable_object, JS::Attribute::Configurable); + define_direct_property(vm.well_known_symbol_unscopables(), unscopable_object, JS::Attribute::Configurable); )~~~"); } generator.append(R"~~~( - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(JS::PrimitiveString::create(vm, "@namespaced_name@"sv)), JS::Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(JS::PrimitiveString::create(vm, "@namespaced_name@"sv)), JS::Attribute::Configurable); )~~~"); if (!is_global_interface) { @@ -3835,7 +3835,7 @@ JS::ThrowCompletionOr @prototype_class@::initialize(JS::Realm& realm) MUST_OR_THROW_OOM(Base::initialize(realm)); define_native_function(realm, vm.names.next, next, 0, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable); - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(JS::PrimitiveString::create(vm, "Iterator"sv)), JS::Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(JS::PrimitiveString::create(vm, "Iterator"sv)), JS::Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index f745e74341..a383818dee 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -147,7 +147,7 @@ ThrowCompletionOr species_constructor(VM& vm, Object const& obj return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, constructor.to_string_without_side_effects())); // 4. Let S be ? Get(C, @@species). - auto species = TRY(constructor.as_object().get(*vm.well_known_symbol_species())); + auto species = TRY(constructor.as_object().get(vm.well_known_symbol_species())); // 5. If S is either undefined or null, return defaultConstructor. if (species.is_nullish()) @@ -1076,7 +1076,7 @@ Object* create_unmapped_arguments_object(VM& vm, Span arguments) // 7. Perform ! DefinePropertyOrThrow(obj, @@iterator, PropertyDescriptor { [[Value]]: %Array.prototype.values%, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }). auto array_prototype_values = realm.intrinsics().array_prototype_values_function(); - MUST(object->define_property_or_throw(*vm.well_known_symbol_iterator(), { .value = array_prototype_values, .writable = true, .enumerable = false, .configurable = true })); + MUST(object->define_property_or_throw(vm.well_known_symbol_iterator(), { .value = array_prototype_values, .writable = true, .enumerable = false, .configurable = true })); // 8. Perform ! DefinePropertyOrThrow(obj, "callee", PropertyDescriptor { [[Get]]: %ThrowTypeError%, [[Set]]: %ThrowTypeError%, [[Enumerable]]: false, [[Configurable]]: false }). auto throw_type_error = realm.intrinsics().throw_type_error_function(); @@ -1159,7 +1159,7 @@ Object* create_mapped_arguments_object(VM& vm, FunctionObject& function, Vector< // 20. Perform ! DefinePropertyOrThrow(obj, @@iterator, PropertyDescriptor { [[Value]]: %Array.prototype.values%, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }). auto array_prototype_values = realm.intrinsics().array_prototype_values_function(); - MUST(object->define_property_or_throw(*vm.well_known_symbol_iterator(), { .value = array_prototype_values, .writable = true, .enumerable = false, .configurable = true })); + MUST(object->define_property_or_throw(vm.well_known_symbol_iterator(), { .value = array_prototype_values, .writable = true, .enumerable = false, .configurable = true })); // 21. Perform ! DefinePropertyOrThrow(obj, "callee", PropertyDescriptor { [[Value]]: func, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }). MUST(object->define_property_or_throw(vm.names.callee, { .value = &function, .writable = true, .enumerable = false, .configurable = true })); @@ -1401,7 +1401,7 @@ ThrowCompletionOr> get_dispose_method(VM& vm, Value value, // 2. Else, // a. Let method be ? GetMethod(V, @@dispose). - return GCPtr { TRY(value.get_method(vm, *vm.well_known_symbol_dispose())) }; + return GCPtr { TRY(value.get_method(vm, vm.well_known_symbol_dispose())) }; } // 2.1.5 Dispose ( V, hint, method ), https://tc39.es/proposal-explicit-resource-management/#sec-dispose diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp index 50f541ef80..cfe3fce65b 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp @@ -31,7 +31,7 @@ ThrowCompletionOr ArrayBufferConstructor::initialize(Realm& realm) define_native_function(realm, vm.names.isView, is_view, 1, attr); // 25.1.5.4 ArrayBuffer.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-arraybuffer.prototype-@@tostringtag - define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp index 5bae2308b8..c6d42fa818 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp @@ -28,7 +28,7 @@ ThrowCompletionOr ArrayBufferPrototype::initialize(Realm& realm) define_native_accessor(realm, vm.names.byteLength, byte_length_getter, {}, Attribute::Configurable); // 25.1.5.4 ArrayBuffer.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-arraybuffer.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.ArrayBuffer.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.ArrayBuffer.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp index 9d14df59b2..95b1efaaa8 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp @@ -35,7 +35,7 @@ ThrowCompletionOr ArrayConstructor::initialize(Realm& realm) define_native_function(realm, vm.names.of, of, 0, attr); // 23.1.2.5 get Array [ @@species ], https://tc39.es/ecma262/#sec-get-array-@@species - define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); @@ -155,7 +155,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from) } // 4. Let usingIterator be ? GetMethod(items, @@iterator). - auto using_iterator = TRY(items.get_method(vm, *vm.well_known_symbol_iterator())); + auto using_iterator = TRY(items.get_method(vm, vm.well_known_symbol_iterator())); // 5. If usingIterator is not undefined, then if (using_iterator) { diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp index c7390316ce..bcdcef447c 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp @@ -27,7 +27,7 @@ ThrowCompletionOr ArrayIteratorPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); // 23.1.5.2.2 %ArrayIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%arrayiteratorprototype%-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Array Iterator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Array Iterator"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index bd3db43e70..72c00bf416 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -84,7 +84,7 @@ ThrowCompletionOr ArrayPrototype::initialize(Realm& realm) // Object.is(Array.prototype[Symbol.iterator], Array.prototype.values) // evaluates to true // 23.1.3.40 Array.prototype [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-array.prototype-@@iterator - define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.values), attr); + define_direct_property(vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.values), attr); // 23.1.3.41 Array.prototype [ @@unscopables ], https://tc39.es/ecma262/#sec-array.prototype-@@unscopables // With array grouping proposal, https://tc39.es/proposal-array-grouping/#sec-array.prototype-@@unscopables @@ -108,7 +108,7 @@ ThrowCompletionOr ArrayPrototype::initialize(Realm& realm) MUST(unscopable_list->create_data_property_or_throw(vm.names.toSpliced, Value(true))); MUST(unscopable_list->create_data_property_or_throw(vm.names.values, Value(true))); - define_direct_property(*vm.well_known_symbol_unscopables(), unscopable_list, Attribute::Configurable); + define_direct_property(vm.well_known_symbol_unscopables(), unscopable_list, Attribute::Configurable); return {}; } @@ -135,7 +135,7 @@ static ThrowCompletionOr array_species_create(VM& vm, Object& original_ } if (constructor.is_object()) { - constructor = TRY(constructor.as_object().get(*vm.well_known_symbol_species())); + constructor = TRY(constructor.as_object().get(vm.well_known_symbol_species())); if (constructor.is_null()) constructor = js_undefined(); } @@ -183,7 +183,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat) if (!val.is_object()) return false; auto& object = val.as_object(); - auto spreadable = TRY(object.get(*vm.well_known_symbol_is_concat_spreadable())); + auto spreadable = TRY(object.get(vm.well_known_symbol_is_concat_spreadable())); if (!spreadable.is_undefined()) return spreadable.to_boolean(); diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.cpp index ae84175595..e4e823e575 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.cpp @@ -20,7 +20,7 @@ ThrowCompletionOr AsyncFunctionPrototype::initialize(Realm& realm) MUST_OR_THROW_OOM(Base::initialize(realm)); // 27.7.3.2 AsyncFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-async-function-prototype-properties-toStringTag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.AsyncFunction.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.AsyncFunction.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.cpp index fbd6e496e6..b52c63123c 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.cpp @@ -27,7 +27,7 @@ ThrowCompletionOr AsyncGeneratorFunctionPrototype::initialize(Realm& realm define_direct_property(vm.names.prototype, realm.intrinsics().async_generator_prototype(), Attribute::Configurable); // 27.4.3.3 AsyncGeneratorFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-asyncgeneratorfunction-prototype-tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.AsyncGeneratorFunction.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.AsyncGeneratorFunction.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.cpp index b99b9a085c..562ee43de7 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.cpp @@ -20,7 +20,7 @@ ThrowCompletionOr AsyncGeneratorPrototype::initialize(Realm& realm) MUST_OR_THROW_OOM(Base::initialize(realm)); // 27.6.1.5 AsyncGenerator.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-asyncgenerator-prototype-tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "AsyncGenerator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "AsyncGenerator"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp index 652bc17e99..59cb821149 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp @@ -18,7 +18,7 @@ ThrowCompletionOr AsyncIteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); MUST_OR_THROW_OOM(Base::initialize(realm)); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(realm, *vm.well_known_symbol_async_iterator(), symbol_async_iterator, 0, attr); + define_native_function(realm, vm.well_known_symbol_async_iterator(), symbol_async_iterator, 0, attr); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp b/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp index 5c9d4ae97c..02af92a8ad 100644 --- a/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp @@ -147,7 +147,7 @@ ThrowCompletionOr AtomicsObject::initialize(Realm& realm) define_native_function(realm, vm.names.xor_, xor_, 3, attr); // 25.4.15 Atomics [ @@toStringTag ], https://tc39.es/ecma262/#sec-atomics-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Atomics"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Atomics"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp index 6f00945064..db46d2a497 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp @@ -32,7 +32,7 @@ ThrowCompletionOr BigIntPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.valueOf, value_of, 0, attr); // 21.2.3.5 BigInt.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-bigint.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.BigInt.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.BigInt.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp index 1252fe5116..bd695f72df 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp @@ -47,7 +47,7 @@ ThrowCompletionOr DataViewPrototype::initialize(Realm& realm) define_native_accessor(realm, vm.names.byteOffset, byte_offset_getter, {}, Attribute::Configurable); // 25.3.4.25 DataView.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-dataview.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.DataView.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.DataView.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp index 5e0a4f9cda..b7d5776dd8 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -87,7 +87,7 @@ ThrowCompletionOr DatePrototype::initialize(Realm& realm) define_native_function(realm, vm.names.setYear, set_year, 1, attr); // 21.4.4.45 Date.prototype [ @@toPrimitive ] ( hint ), https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive - define_native_function(realm, *vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); + define_native_function(realm, vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); // Aliases. define_native_function(realm, vm.names.valueOf, get_time, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp b/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp index 3bcca253eb..b43d2f262c 100644 --- a/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp @@ -31,10 +31,10 @@ ThrowCompletionOr DisposableStackPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.move, move_, 0, attr); // 11.3.3.7 DisposableStack.prototype [ @@dispose ] (), https://tc39.es/proposal-explicit-resource-management/#sec-disposablestack.prototype-@@dispose - define_direct_property(*vm.well_known_symbol_dispose(), get_without_side_effects(vm.names.dispose), attr); + define_direct_property(vm.well_known_symbol_dispose(), get_without_side_effects(vm.names.dispose), attr); // 11.3.3.8 DisposableStack.prototype [ @@toStringTag ], https://tc39.es/proposal-explicit-resource-management/#sec-disposablestack.prototype-@@toStringTag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.DisposableStack.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.DisposableStack.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp index 4d97055ab2..fd3ee181ce 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr FinalizationRegistryPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.unregister, unregister, 1, attr); // 26.2.3.4 FinalizationRegistry.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-finalization-registry.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.FinalizationRegistry.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.FinalizationRegistry.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp index fc2b1460d5..cafd62b2d5 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -34,7 +34,7 @@ ThrowCompletionOr FunctionPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.bind, bind, 1, attr); define_native_function(realm, vm.names.call, call, 1, attr); define_native_function(realm, vm.names.toString, to_string, 0, attr); - define_native_function(realm, *vm.well_known_symbol_has_instance(), symbol_has_instance, 1, 0); + define_native_function(realm, vm.well_known_symbol_has_instance(), symbol_has_instance, 1, 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.cpp index 9f138b32c2..175171d668 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.cpp @@ -23,7 +23,7 @@ ThrowCompletionOr GeneratorFunctionPrototype::initialize(Realm& realm) // 27.3.3.2 GeneratorFunction.prototype.prototype, https://tc39.es/ecma262/#sec-generatorfunction.prototype.prototype define_direct_property(vm.names.prototype, realm.intrinsics().generator_prototype(), Attribute::Configurable); // 27.3.3.3 GeneratorFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-generatorfunction.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "GeneratorFunction"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "GeneratorFunction"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp index aa64d6fde3..c487481be0 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp @@ -24,7 +24,7 @@ ThrowCompletionOr GeneratorPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.throw_, throw_, 1, attr); // 27.5.1.5 Generator.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-generator.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Generator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Generator"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp index 9a42cc411d..aadc089367 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp @@ -24,7 +24,7 @@ ThrowCompletionOr CollatorPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 10.3.2 Intl.Collator.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.collator.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Collator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Collator"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_accessor(realm, vm.names.compare, compare_getter, {}, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp index dce8035fdb..3fd6e36519 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr DateTimeFormatPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 11.3.2 Intl.DateTimeFormat.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DateTimeFormat"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DateTimeFormat"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.format, format, nullptr, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp index c5a79e3d09..d0f25c0c43 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr DisplayNamesPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 12.3.2 Intl.DisplayNames.prototype[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DisplayNames"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DisplayNames"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.of, of, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp index 884d5e7d53..c457427c69 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp @@ -25,7 +25,7 @@ ThrowCompletionOr DurationFormatPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 1.4.2 Intl.DurationFormat.prototype [ @@toStringTag ], https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DurationFormat"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.DurationFormat"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.format, format, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp b/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp index 0dc9eeffe7..f0b21f4b2f 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp @@ -39,7 +39,7 @@ ThrowCompletionOr Intl::initialize(Realm& realm) auto& vm = this->vm(); // 8.1.1 Intl[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl-toStringTag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_intrinsic_accessor(vm.names.Collator, attr, [](auto& realm) -> Value { return realm.intrinsics().intl_collator_constructor(); }); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp index 62380ff9bf..d4c451241c 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp @@ -25,7 +25,7 @@ ThrowCompletionOr ListFormatPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 13.3.2 Intl.ListFormat.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.ListFormat.prototype-toStringTag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.ListFormat"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.ListFormat"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.format, format, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp index f22fe16213..adf5ec54aa 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp @@ -31,7 +31,7 @@ ThrowCompletionOr LocalePrototype::initialize(Realm& realm) define_native_function(realm, vm.names.toString, to_string, 0, attr); // 14.3.2 Intl.Locale.prototype[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.Locale.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Locale"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Locale"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.baseName, base_name, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.calendar, calendar, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp index 8308f7a4d0..4f08a08b59 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr NumberFormatPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 15.3.2 Intl.NumberFormat.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.numberformat.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.NumberFormat"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.NumberFormat"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.format, format, nullptr, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp index c972374374..3b0217b1ce 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp @@ -25,7 +25,7 @@ ThrowCompletionOr PluralRulesPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 16.3.2 Intl.PluralRules.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.pluralrules.prototype-tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.PluralRules"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.PluralRules"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.select, select, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp index bdd562ac10..704ea7cf58 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp @@ -23,7 +23,7 @@ ThrowCompletionOr RelativeTimeFormatPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 17.3.2 Intl.RelativeTimeFormat.prototype[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype-toStringTag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.RelativeTimeFormat"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.RelativeTimeFormat"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.format, format, 2, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp index c9cc4e81eb..b140a94ae2 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp @@ -25,7 +25,7 @@ ThrowCompletionOr SegmentIteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 18.6.2.2 %SegmentIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma402/#sec-%segmentiteratorprototype%.@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Segmenter String Iterator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Segmenter String Iterator"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.next, next, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp index 9ec0dcfabe..70aadd69c2 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp @@ -24,7 +24,7 @@ ThrowCompletionOr SegmenterPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 18.3.2 Intl.Segmenter.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.segmenter.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Segmenter"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Segmenter"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp index 2115f75d9c..4f6d6654fe 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp @@ -24,7 +24,7 @@ ThrowCompletionOr SegmentsPrototype::initialize(Realm& realm) auto& vm = this->vm(); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(realm, *vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); + define_native_function(realm, vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); define_native_function(realm, vm.names.containing, containing, 1, attr); return {}; diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp index 1223fcd36a..912ea5e5f5 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Matthew Olsson - * Copyright (c) 2022, Linus Groh + * Copyright (c) 2022-2023, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ @@ -24,12 +24,12 @@ ThrowCompletionOr get_iterator(VM& vm, Value value, IteratorHint hint, // a. If hint is async, then if (hint == IteratorHint::Async) { // i. Set method to ? GetMethod(obj, @@asyncIterator). - auto* async_method = TRY(value.get_method(vm, *vm.well_known_symbol_async_iterator())); + auto* async_method = TRY(value.get_method(vm, vm.well_known_symbol_async_iterator())); // ii. If method is undefined, then if (async_method == nullptr) { // 1. Let syncMethod be ? GetMethod(obj, @@iterator). - auto* sync_method = TRY(value.get_method(vm, *vm.well_known_symbol_iterator())); + auto* sync_method = TRY(value.get_method(vm, vm.well_known_symbol_iterator())); // 2. Let syncIteratorRecord be ? GetIterator(obj, sync, syncMethod). auto sync_iterator_record = TRY(get_iterator(vm, value, IteratorHint::Sync, sync_method)); @@ -42,7 +42,7 @@ ThrowCompletionOr get_iterator(VM& vm, Value value, IteratorHint hint, } // b. Otherwise, set method to ? GetMethod(obj, @@iterator). else { - method = TRY(value.get_method(vm, *vm.well_known_symbol_iterator())); + method = TRY(value.get_method(vm, vm.well_known_symbol_iterator())); } } diff --git a/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp index 53c938f8eb..26035ec439 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp @@ -21,7 +21,7 @@ ThrowCompletionOr IteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); MUST_OR_THROW_OOM(Base::initialize(realm)); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(realm, *vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); + define_native_function(realm, vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index c7bb90a949..439ddff43a 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -40,7 +40,7 @@ ThrowCompletionOr JSONObject::initialize(Realm& realm) define_native_function(realm, vm.names.parse, parse, 2, attr); // 25.5.3 JSON [ @@toStringTag ], https://tc39.es/ecma262/#sec-json-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "JSON"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "JSON"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp index 126bd34b7f..28fcc18517 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr MapConstructor::initialize(Realm& realm) // 24.1.2.1 Map.prototype, https://tc39.es/ecma262/#sec-map.prototype define_direct_property(vm.names.prototype, realm.intrinsics().map_prototype(), 0); - define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp index 47c2aaa73f..5a7b1bae1a 100644 --- a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp @@ -24,7 +24,7 @@ ThrowCompletionOr MapIteratorPrototype::initialize(Realm& realm) MUST_OR_THROW_OOM(Base::initialize(realm)); define_native_function(realm, vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Map Iterator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Map Iterator"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp index e822d3874c..abc392f82c 100644 --- a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp @@ -35,8 +35,8 @@ ThrowCompletionOr MapPrototype::initialize(Realm& realm) define_native_accessor(realm, vm.names.size, size_getter, {}, Attribute::Configurable); - define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.entries), attr); - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Map.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.entries), attr); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Map.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/MathObject.cpp b/Userland/Libraries/LibJS/Runtime/MathObject.cpp index f02c07e489..62ee72f5cc 100644 --- a/Userland/Libraries/LibJS/Runtime/MathObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/MathObject.cpp @@ -72,7 +72,7 @@ ThrowCompletionOr MathObject::initialize(Realm& realm) define_direct_property(vm.names.SQRT2, Value(M_SQRT2), 0); // 21.3.1.9 Math [ @@toStringTag ], https://tc39.es/ecma262/#sec-math-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Math.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Math.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp index d9e2392a3a..55e89eb7ad 100644 --- a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp @@ -24,10 +24,11 @@ ModuleNamespaceObject::ModuleNamespaceObject(Realm& realm, Module* module, Vecto ThrowCompletionOr ModuleNamespaceObject::initialize(Realm& realm) { + auto& vm = this->vm(); MUST_OR_THROW_OOM(Base::initialize(realm)); // 28.3.1 @@toStringTag, https://tc39.es/ecma262/#sec-@@tostringtag - define_direct_property(*vm().well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm(), "Module"sv)), 0); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Module"sv)), 0); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp index 91211079f4..d3d831e713 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020-2021, Andreas Kling - * Copyright (c) 2021-2022, Linus Groh + * Copyright (c) 2021-2023, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ @@ -42,7 +42,7 @@ ThrowCompletionOr ObjectEnvironment::has_binding(DeprecatedFlyString const return true; // 5. Let unscopables be ? Get(bindingObject, @@unscopables). - auto unscopables = TRY(m_binding_object->get(*vm.well_known_symbol_unscopables())); + auto unscopables = TRY(m_binding_object->get(vm.well_known_symbol_unscopables())); // 6. If Type(unscopables) is Object, then if (unscopables.is_object()) { diff --git a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp index b1012273f7..13ca16612a 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling - * Copyright (c) 2020-2022, Linus Groh + * Copyright (c) 2020-2023, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ @@ -118,7 +118,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string) builtin_tag = "Object"; // 15. Let tag be ? Get(O, @@toStringTag). - auto to_string_tag = TRY(object->get(*vm.well_known_symbol_to_string_tag())); + auto to_string_tag = TRY(object->get(vm.well_known_symbol_to_string_tag())); // Optimization: Instead of creating another PrimitiveString from builtin_tag, we separate tag and to_string_tag and add an additional branch to step 16. DeprecatedString tag; diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index d339cfc700..3c5404f142 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -260,7 +260,7 @@ ThrowCompletionOr PromiseConstructor::initialize(Realm& realm) define_native_function(realm, vm.names.reject, reject, 1, attr); define_native_function(realm, vm.names.resolve, resolve, 1, attr); - define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp index e73e5d182e..62fb270fff 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp @@ -32,7 +32,7 @@ ThrowCompletionOr PromisePrototype::initialize(Realm& realm) define_native_function(realm, vm.names.finally, finally, 1, attr); // 27.2.5.5 Promise.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-promise.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Promise.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Promise.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/PropertyKey.h b/Userland/Libraries/LibJS/Runtime/PropertyKey.h index 0cd8f3f28c..9230fed849 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyKey.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyKey.h @@ -80,9 +80,9 @@ public: VERIFY(!m_string.is_null()); } - PropertyKey(Symbol& symbol) + PropertyKey(NonnullGCPtr symbol) : m_type(Type::Symbol) - , m_symbol(&symbol) + , m_symbol(symbol) { } diff --git a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp index f3ba6ed5ab..0c644337ac 100644 --- a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp @@ -40,7 +40,7 @@ ThrowCompletionOr ReflectObject::initialize(Realm& realm) define_native_function(realm, vm.names.setPrototypeOf, set_prototype_of, 2, attr); // 28.1.14 Reflect [ @@toStringTag ], https://tc39.es/ecma262/#sec-reflect-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Reflect.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Reflect.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp index 9930f6d6fa..2c4c269e47 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp @@ -25,7 +25,7 @@ ThrowCompletionOr RegExpConstructor::initialize(Realm& realm) // 22.2.4.1 RegExp.prototype, https://tc39.es/ecma262/#sec-regexp.prototype define_direct_property(vm.names.prototype, realm.intrinsics().regexp_prototype(), 0); - define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index f07b68cc44..d55e58b633 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -37,11 +37,11 @@ ThrowCompletionOr RegExpPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.exec, exec, 1, attr); define_native_function(realm, vm.names.compile, compile, 2, attr); - define_native_function(realm, *vm.well_known_symbol_match(), symbol_match, 1, attr); - define_native_function(realm, *vm.well_known_symbol_match_all(), symbol_match_all, 1, attr); - define_native_function(realm, *vm.well_known_symbol_replace(), symbol_replace, 2, attr); - define_native_function(realm, *vm.well_known_symbol_search(), symbol_search, 1, attr); - define_native_function(realm, *vm.well_known_symbol_split(), symbol_split, 2, attr); + define_native_function(realm, vm.well_known_symbol_match(), symbol_match, 1, attr); + define_native_function(realm, vm.well_known_symbol_match_all(), symbol_match_all, 1, attr); + define_native_function(realm, vm.well_known_symbol_replace(), symbol_replace, 2, attr); + define_native_function(realm, vm.well_known_symbol_search(), symbol_search, 1, attr); + define_native_function(realm, vm.well_known_symbol_split(), symbol_split, 2, attr); define_native_accessor(realm, vm.names.flags, flags, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.source, source, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp index c415716eb0..eec552f1f3 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr RegExpStringIteratorPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.next, next, 0, attr); // 22.2.7.2.2 %RegExpStringIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%regexpstringiteratorprototype%-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "RegExp String Iterator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "RegExp String Iterator"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp b/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp index 60a2775540..21354b22a5 100644 --- a/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr SetConstructor::initialize(Realm& realm) // 24.2.2.1 Set.prototype, https://tc39.es/ecma262/#sec-set.prototype define_direct_property(vm.names.prototype, realm.intrinsics().set_prototype(), 0); - define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp index c93538009a..85f230bd70 100644 --- a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr SetIteratorPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); // 24.2.5.2.2 %SetIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%setiteratorprototype%-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Set Iterator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Set Iterator"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp index fcc8370b5f..8db0e60790 100644 --- a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp @@ -44,10 +44,10 @@ ThrowCompletionOr SetPrototype::initialize(Realm& realm) define_direct_property(vm.names.keys, get_without_side_effects(vm.names.values), attr); // 24.2.3.11 Set.prototype [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-set.prototype-@@iterator - define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.values), attr); + define_direct_property(vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.values), attr); // 24.2.3.12 Set.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-set.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Set.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.Set.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp index fcfc7aee95..5abe4e91c2 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp @@ -26,7 +26,7 @@ ThrowCompletionOr ShadowRealmPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.importValue, import_value, 2, attr); // 3.4.3 ShadowRealm.prototype [ @@toStringTag ], https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.ShadowRealm.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.ShadowRealm.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp index 66d6a9cc67..d0c1d2ff90 100644 --- a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp @@ -25,7 +25,7 @@ ThrowCompletionOr StringIteratorPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); // 22.1.5.1.2 %StringIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%stringiteratorprototype%-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "String Iterator"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "String Iterator"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 301cd0a0d7..0d452174cc 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -194,7 +194,7 @@ ThrowCompletionOr StringPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.trimEnd, trim_end, 0, attr); define_native_function(realm, vm.names.trimStart, trim_start, 0, attr); define_native_function(realm, vm.names.valueOf, value_of, 0, attr); - define_native_function(realm, *vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); + define_native_function(realm, vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); // B.2.2 Additional Properties of the String.prototype Object, https://tc39.es/ecma262/#sec-additional-properties-of-the-string.prototype-object define_native_function(realm, vm.names.substr, substr, 2, attr); @@ -464,14 +464,14 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match) auto this_object = TRY(require_object_coercible(vm, vm.this_value())); auto regexp = vm.argument(0); if (!regexp.is_nullish()) { - if (auto* matcher = TRY(regexp.get_method(vm, *vm.well_known_symbol_match()))) + if (auto* matcher = TRY(regexp.get_method(vm, vm.well_known_symbol_match()))) return TRY(call(vm, *matcher, regexp, this_object)); } auto string = TRY(this_object.to_utf16_string(vm)); auto rx = TRY(regexp_create(vm, regexp, js_undefined())); - return TRY(Value(rx).invoke(vm, *vm.well_known_symbol_match(), PrimitiveString::create(vm, move(string)))); + return TRY(Value(rx).invoke(vm, vm.well_known_symbol_match(), PrimitiveString::create(vm, move(string)))); } // 22.1.3.13 String.prototype.matchAll ( regexp ), https://tc39.es/ecma262/#sec-string.prototype.matchall @@ -488,14 +488,14 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match_all) if (!flags_string.contains('g')) return vm.throw_completion(ErrorType::StringNonGlobalRegExp); } - if (auto* matcher = TRY(regexp.get_method(vm, *vm.well_known_symbol_match_all()))) + if (auto* matcher = TRY(regexp.get_method(vm, vm.well_known_symbol_match_all()))) return TRY(call(vm, *matcher, regexp, this_object)); } auto string = TRY(this_object.to_utf16_string(vm)); auto rx = TRY(regexp_create(vm, regexp, PrimitiveString::create(vm, "g"_short_string))); - return TRY(Value(rx).invoke(vm, *vm.well_known_symbol_match_all(), PrimitiveString::create(vm, move(string)))); + return TRY(Value(rx).invoke(vm, vm.well_known_symbol_match_all(), PrimitiveString::create(vm, move(string)))); } // 22.1.3.14 String.prototype.normalize ( [ form ] ), https://tc39.es/ecma262/#sec-string.prototype.normalize @@ -613,7 +613,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::replace) auto replace_value = vm.argument(1); if (!search_value.is_nullish()) { - if (auto* replacer = TRY(search_value.get_method(vm, *vm.well_known_symbol_replace()))) + if (auto* replacer = TRY(search_value.get_method(vm, vm.well_known_symbol_replace()))) return TRY(call(vm, *replacer, search_value, this_object, replace_value)); } @@ -665,7 +665,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::replace_all) return vm.throw_completion(ErrorType::StringNonGlobalRegExp); } - auto* replacer = TRY(search_value.get_method(vm, *vm.well_known_symbol_replace())); + auto* replacer = TRY(search_value.get_method(vm, vm.well_known_symbol_replace())); if (replacer) return TRY(call(vm, *replacer, search_value, this_object, replace_value)); } @@ -722,14 +722,14 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::search) auto this_object = TRY(require_object_coercible(vm, vm.this_value())); auto regexp = vm.argument(0); if (!regexp.is_nullish()) { - if (auto* searcher = TRY(regexp.get_method(vm, *vm.well_known_symbol_search()))) + if (auto* searcher = TRY(regexp.get_method(vm, vm.well_known_symbol_search()))) return TRY(call(vm, *searcher, regexp, this_object)); } auto string = TRY(this_object.to_utf16_string(vm)); auto rx = TRY(regexp_create(vm, regexp, js_undefined())); - return TRY(Value(rx).invoke(vm, *vm.well_known_symbol_search(), PrimitiveString::create(vm, move(string)))); + return TRY(Value(rx).invoke(vm, vm.well_known_symbol_search(), PrimitiveString::create(vm, move(string)))); } // 22.1.3.21 String.prototype.slice ( start, end ), https://tc39.es/ecma262/#sec-string.prototype.slice @@ -774,7 +774,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::split) auto limit_argument = vm.argument(1); if (!separator_argument.is_nullish()) { - auto splitter = TRY(separator_argument.get_method(vm, *vm.well_known_symbol_split())); + auto splitter = TRY(separator_argument.get_method(vm, vm.well_known_symbol_split())); if (splitter) return TRY(call(vm, *splitter, separator_argument, object, limit_argument)); } diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp index 6ec92b05a7..1be690eb50 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp @@ -31,10 +31,10 @@ ThrowCompletionOr SymbolPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.toString, to_string, 0, attr); define_native_function(realm, vm.names.valueOf, value_of, 0, attr); define_native_accessor(realm, vm.names.description, description_getter, {}, Attribute::Configurable); - define_native_function(realm, *vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); + define_native_function(realm, vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); // 20.4.3.6 Symbol.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Symbol"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Symbol"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index 6cf6a0448b..7713d20f86 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -36,7 +36,7 @@ ThrowCompletionOr CalendarPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 12.4.2 Temporal.Calendar.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.Calendar"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.Calendar"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.id, id_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp index 2c3b5a71d9..ccc796a2d4 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp @@ -27,7 +27,7 @@ ThrowCompletionOr DurationPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 7.3.2 Temporal.Duration.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.Duration"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.Duration"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.years, years_getter, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.months, months_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp index ca33a0bb00..3ff0f71877 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp @@ -31,7 +31,7 @@ ThrowCompletionOr InstantPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 8.3.2 Temporal.Instant.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.Instant"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.Instant"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.epochSeconds, epoch_seconds_getter, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.epochMilliseconds, epoch_milliseconds_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp index 009900f92c..8c077ba386 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp @@ -33,7 +33,7 @@ ThrowCompletionOr Now::initialize(Realm& realm) auto& vm = this->vm(); // 2.1.1 Temporal.Now [ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal-now-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.Now"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.Now"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(realm, vm.names.timeZone, time_zone, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp index 7a8950f77c..9ab37dd4a8 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -32,7 +32,7 @@ ThrowCompletionOr PlainDatePrototype::initialize(Realm& realm) auto& vm = this->vm(); // 3.3.2 Temporal.PlainDate.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainDate"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainDate"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.year, year_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index 50d4b5b335..872c7eb5ce 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -33,7 +33,7 @@ ThrowCompletionOr PlainDateTimePrototype::initialize(Realm& realm) auto& vm = this->vm(); // 5.3.2 Temporal.PlainDateTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainDateTime"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainDateTime"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.year, year_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp index 19f0232b06..bef65b9774 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -27,7 +27,7 @@ ThrowCompletionOr PlainMonthDayPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 10.3.2 Temporal.PlainMonthDay.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainMonthDay"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainMonthDay"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp index 7244cee2b2..d4757149c6 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp @@ -32,7 +32,7 @@ ThrowCompletionOr PlainTimePrototype::initialize(Realm& realm) auto& vm = this->vm(); // 4.3.2 Temporal.PlainTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainTime"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainTime"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.hour, hour_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp index 5c74bcb522..cc79cf1400 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -29,7 +29,7 @@ ThrowCompletionOr PlainYearMonthPrototype::initialize(Realm& realm) auto& vm = this->vm(); // 9.3.2 Temporal.PlainYearMonth.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainYearMonth"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.PlainYearMonth"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.year, year_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp index d37ee63b0a..de9638758d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.cpp @@ -33,7 +33,7 @@ ThrowCompletionOr Temporal::initialize(Realm& realm) auto& vm = this->vm(); // 1.1.1 Temporal [ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal"sv)), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_direct_property(vm.names.Now, MUST_OR_THROW_OOM(heap().allocate(realm, realm)), attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp index 99695bef0c..aa123b0b47 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp @@ -42,7 +42,7 @@ ThrowCompletionOr TimeZonePrototype::initialize(Realm& realm) define_native_function(realm, vm.names.toJSON, to_json, 0, attr); // 11.4.2 Temporal.TimeZone.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.TimeZone"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.TimeZone"sv)), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index fe6eebd261..e449846b67 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -33,7 +33,7 @@ ThrowCompletionOr ZonedDateTimePrototype::initialize(Realm& realm) auto& vm = this->vm(); // 6.3.2 Temporal.ZonedDateTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.ZonedDateTime"sv)), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Temporal.ZonedDateTime"sv)), Attribute::Configurable); define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); define_native_accessor(realm, vm.names.timeZone, time_zone_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp index 1f40d37961..5b8c8bfe96 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp @@ -527,7 +527,7 @@ void TypedArrayBase::visit_edges(Visitor& visitor) TRY(initialize_typed_array_from_array_buffer(vm, *typed_array, array_buffer, \ vm.argument(1), vm.argument(2))); \ } else { \ - auto iterator = TRY(first_argument.get_method(vm, *vm.well_known_symbol_iterator())); \ + auto iterator = TRY(first_argument.get_method(vm, vm.well_known_symbol_iterator())); \ if (iterator) { \ auto values = TRY(iterable_to_list(vm, first_argument, iterator)); \ TRY(initialize_typed_array_from_list(vm, *typed_array, values)); \ diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index 17b623e63f..a864d58357 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -33,7 +33,7 @@ ThrowCompletionOr TypedArrayConstructor::initialize(Realm& realm) define_native_function(realm, vm.names.from, from, 1, attr); define_native_function(realm, vm.names.of, of, 0, attr); - define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); @@ -81,7 +81,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) } // 5. Let usingIterator be ? GetMethod(source, @@iterator). - auto* using_iterator = TRY(source.get_method(vm, *vm.well_known_symbol_iterator())); + auto* using_iterator = TRY(source.get_method(vm, vm.well_known_symbol_iterator())); // 6. If usingIterator is not undefined, then if (using_iterator) { diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index f0b95d6c7e..645b7c0ae5 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -63,13 +63,13 @@ ThrowCompletionOr TypedArrayPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.with, with, 2, attr); define_native_function(realm, vm.names.values, values, 0, attr); - define_native_accessor(realm, *vm.well_known_symbol_to_string_tag(), to_string_tag_getter, nullptr, Attribute::Configurable); + define_native_accessor(realm, vm.well_known_symbol_to_string_tag(), to_string_tag_getter, nullptr, Attribute::Configurable); // 23.2.3.34 %TypedArray%.prototype.toString ( ), https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring define_direct_property(vm.names.toString, realm.intrinsics().array_prototype()->get_without_side_effects(vm.names.toString), attr); // 23.2.3.37 %TypedArray%.prototype [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator - define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.values), attr); + define_direct_property(vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.values), attr); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 017acf3a84..eb1dca8ff8 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -65,10 +65,10 @@ public: void gather_roots(HashTable&); -#define __JS_ENUMERATE(SymbolName, snake_name) \ - Symbol* well_known_symbol_##snake_name() const \ - { \ - return m_well_known_symbols.snake_name; \ +#define __JS_ENUMERATE(SymbolName, snake_name) \ + NonnullGCPtr well_known_symbol_##snake_name() const \ + { \ + return *m_well_known_symbols.snake_name; \ } JS_ENUMERATE_WELL_KNOWN_SYMBOLS #undef __JS_ENUMERATE diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 5b01429326..100327c78f 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -302,7 +302,7 @@ ThrowCompletionOr Value::is_regexp(VM& vm) const return false; // 2. Let matcher be ? Get(argument, @@match). - auto matcher = TRY(as_object().get(*vm.well_known_symbol_match())); + auto matcher = TRY(as_object().get(vm.well_known_symbol_match())); // 3. If matcher is not undefined, return ToBoolean(matcher). if (!matcher.is_undefined()) @@ -508,7 +508,7 @@ ThrowCompletionOr Value::to_primitive(VM& vm, PreferredType preferred_typ // 1. If input is an Object, then if (is_object()) { // a. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). - auto* exotic_to_primitive = TRY(get_method(vm, *vm.well_known_symbol_to_primitive())); + auto* exotic_to_primitive = TRY(get_method(vm, vm.well_known_symbol_to_primitive())); // b. If exoticToPrim is not undefined, then if (exotic_to_primitive) { @@ -2062,7 +2062,7 @@ ThrowCompletionOr instance_of(VM& vm, Value value, Value target) return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); // 2. Let instOfHandler be ? GetMethod(target, @@hasInstance). - auto* instance_of_handler = TRY(target.get_method(vm, *vm.well_known_symbol_has_instance())); + auto* instance_of_handler = TRY(target.get_method(vm, vm.well_known_symbol_has_instance())); // 3. If instOfHandler is not undefined, then if (instance_of_handler) { diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp index 54048ab8b3..8ad86e52fe 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp @@ -28,7 +28,7 @@ ThrowCompletionOr WeakMapPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.set, set, 2, attr); // 24.3.3.6 WeakMap.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-weakmap.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.WeakMap.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.WeakMap.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp index 7fe74c7c5f..24ee58c3ee 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp @@ -21,7 +21,7 @@ ThrowCompletionOr WeakRefPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.deref, deref, 0, Attribute::Writable | Attribute::Configurable); - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.WeakRef.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.WeakRef.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp index b13cc9b790..9fc13c60f9 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp @@ -27,7 +27,7 @@ ThrowCompletionOr WeakSetPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.has, has, 1, attr); // 24.4.3.5 WeakSet.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-weakset.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.WeakSet.as_string()), Attribute::Configurable); + define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.WeakSet.as_string()), Attribute::Configurable); return {}; } diff --git a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp index 6f23225b9b..afa1dbc4e9 100644 --- a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp +++ b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp @@ -55,7 +55,7 @@ static JS::ThrowCompletionOr> convert_value_to_sequence_of_string return vm.throw_completion(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); // 2. Let method be ? GetMethod(V, @@iterator). - auto* method = TRY(value.get_method(vm, *vm.well_known_symbol_iterator())); + auto* method = TRY(value.get_method(vm, vm.well_known_symbol_iterator())); // 3. If method is undefined, throw a TypeError. if (!method)