diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 703a4fcd9c..78c225c928 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. diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index fee29615e8..8fe64cc2cd 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -894,7 +894,7 @@ ThrowCompletionOr GetMethod::execute_impl(Bytecode::Interpreter& interpret { auto& vm = interpreter.vm(); auto identifier = interpreter.current_executable().get_identifier(m_property); - auto* method = TRY(interpreter.accumulator().get_method(vm, identifier)); + auto method = TRY(interpreter.accumulator().get_method(vm, identifier)); interpreter.accumulator() = method ?: js_undefined(); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index a383818dee..242c0c6784 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -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 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/AsyncFromSyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp index b366ea9f4e..6c1c871175 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp @@ -112,7 +112,7 @@ JS_DEFINE_NATIVE_FUNCTION(AsyncFromSyncIteratorPrototype::return_) // 5. Let return be Completion(GetMethod(syncIterator, "return")). // 6. IfAbruptRejectPromise(return, promiseCapability). - auto* return_method = TRY_OR_REJECT(vm, promise_capability, Value(sync_iterator).get_method(vm, vm.names.return_)); + auto return_method = TRY_OR_REJECT(vm, promise_capability, Value(sync_iterator).get_method(vm, vm.names.return_)); // 7. If return is undefined, then if (return_method == nullptr) { @@ -165,7 +165,7 @@ JS_DEFINE_NATIVE_FUNCTION(AsyncFromSyncIteratorPrototype::throw_) // 5. Let throw be Completion(GetMethod(syncIterator, "throw")). // 6. IfAbruptRejectPromise(throw, promiseCapability). - auto* throw_method = TRY_OR_REJECT(vm, promise_capability, Value(sync_iterator).get_method(vm, vm.names.throw_)); + auto throw_method = TRY_OR_REJECT(vm, promise_capability, Value(sync_iterator).get_method(vm, vm.names.throw_)); // 7. If throw is undefined, then if (throw_method == nullptr) { diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp index 912ea5e5f5..369fd3d2cd 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -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)); @@ -139,7 +139,7 @@ static Completion iterator_close_impl(VM& vm, Iterator const& iterator_record, C // 4. If innerResult.[[Type]] is normal, then if (!inner_result.is_error()) { // a. Let return be innerResult.[[Value]]. - auto* return_method = get_method_result.value(); + auto return_method = get_method_result.value(); // b. If return is undefined, return ? completion. if (!return_method) diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 2dbfa9de30..f95f0bfe58 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -464,7 +464,7 @@ 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)); } @@ -488,7 +488,7 @@ 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)); } @@ -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,7 +722,7 @@ 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)); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 5282c9d981..c051347924 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -139,7 +139,7 @@ ThrowCompletionOr> calendar_fields(VM& vm, Object& calendar, Vect ThrowCompletionOr calendar_merge_fields(VM& vm, Object& calendar, Object& fields, Object& additional_fields) { // 1. Let mergeFields be ? GetMethod(calendar, "mergeFields"). - auto* merge_fields = TRY(Value(&calendar).get_method(vm, vm.names.mergeFields)); + auto merge_fields = TRY(Value(&calendar).get_method(vm, vm.names.mergeFields)); // 2. If mergeFields is undefined, then if (!merge_fields) { diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp index 8bc6184cef..c5e8cffad8 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, Linus Groh + * Copyright (c) 2021-2023, Linus Groh * Copyright (c) 2021, Luke Wilde * * SPDX-License-Identifier: BSD-2-Clause @@ -678,10 +678,10 @@ ThrowCompletionOr unbalance_duration_relative(VM& vm, double } // b. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); // c. Let dateUntil be ? GetMethod(calendar, "dateUntil"). - auto* date_until = TRY(Value(calendar).get_method(vm, vm.names.dateUntil)); + auto date_until = TRY(Value(calendar).get_method(vm, vm.names.dateUntil)); // d. Repeat, while years ≠ 0, while (years != 0) { @@ -719,7 +719,7 @@ ThrowCompletionOr unbalance_duration_relative(VM& vm, double } // b. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); // c. Repeat, while years ≠ 0, while (years != 0) { @@ -762,7 +762,7 @@ ThrowCompletionOr unbalance_duration_relative(VM& vm, double } // ii. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); // iii. Repeat, while years ≠ 0, while (years != 0) { @@ -856,7 +856,7 @@ ThrowCompletionOr balance_duration_relative(VM& vm, double y // 10. If largestUnit is "year", then if (largest_unit == "year"sv) { // a. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(&calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(&calendar).get_method(vm, vm.names.dateAdd)); // b. Let moveResult be ? MoveRelativeDate(calendar, relativeTo, oneYear, dateAdd). auto move_result = TRY(move_relative_date(vm, calendar, *relative_to, *one_year, date_add)); @@ -922,7 +922,7 @@ ThrowCompletionOr balance_duration_relative(VM& vm, double y new_relative_to = TRY(calendar_date_add(vm, calendar, relative_to, *one_year, nullptr, date_add)); // k. Let dateUntil be ? GetMethod(calendar, "dateUntil"). - auto* date_until = TRY(Value(&calendar).get_method(vm, vm.names.dateUntil)); + auto date_until = TRY(Value(&calendar).get_method(vm, vm.names.dateUntil)); // l. Let untilOptions be OrdinaryObjectCreate(null). auto until_options = Object::create(realm, nullptr); @@ -966,7 +966,7 @@ ThrowCompletionOr balance_duration_relative(VM& vm, double y // 11. Else if largestUnit is "month", then else if (largest_unit == "month"sv) { // a. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(&calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(&calendar).get_method(vm, vm.names.dateAdd)); // b. Let moveResult be ? MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd). auto move_result = TRY(move_relative_date(vm, calendar, *relative_to, *one_month, date_add)); @@ -1004,7 +1004,7 @@ ThrowCompletionOr balance_duration_relative(VM& vm, double y VERIFY(largest_unit == "week"sv); // b. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(&calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(&calendar).get_method(vm, vm.names.dateAdd)); // c. Let moveResult be ? MoveRelativeDate(calendar, relativeTo, oneWeek, dateAdd). auto move_result = TRY(move_relative_date(vm, calendar, *relative_to, *one_week, date_add)); @@ -1094,7 +1094,7 @@ ThrowCompletionOr add_duration(VM& vm, double years1, double mon auto* date_duration2 = MUST(create_temporal_duration(vm, years2, months2, weeks2, days2, 0, 0, 0, 0, 0, 0)); // d. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(&calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(&calendar).get_method(vm, vm.names.dateAdd)); // e. Let intermediate be ? CalendarDateAdd(calendar, relativeTo, dateDuration1, undefined, dateAdd). auto* intermediate = TRY(calendar_date_add(vm, calendar, &relative_to, *date_duration1, nullptr, date_add)); @@ -1282,7 +1282,7 @@ ThrowCompletionOr round_duration(VM& vm, double years, double m auto* years_duration = MUST(create_temporal_duration(vm, years, 0, 0, 0, 0, 0, 0, 0, 0, 0)); // b. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); // c. Let yearsLater be ? CalendarDateAdd(calendar, relativeTo, yearsDuration, undefined, dateAdd). auto* years_later = TRY(calendar_date_add(vm, *calendar, relative_to, *years_duration, nullptr, date_add)); @@ -1372,7 +1372,7 @@ ThrowCompletionOr round_duration(VM& vm, double years, double m auto* years_months = MUST(create_temporal_duration(vm, years, months, 0, 0, 0, 0, 0, 0, 0, 0)); // b. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); // c. Let yearsMonthsLater be ? CalendarDateAdd(calendar, relativeTo, yearsMonths, undefined, dateAdd). auto* years_months_later = TRY(calendar_date_add(vm, *calendar, relative_to, *years_months, nullptr, date_add)); @@ -1449,7 +1449,7 @@ ThrowCompletionOr round_duration(VM& vm, double years, double m auto* one_week = MUST(create_temporal_duration(vm, 0, 0, sign, 0, 0, 0, 0, 0, 0, 0)); // c. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - auto* date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); + auto date_add = TRY(Value(calendar).get_method(vm, vm.names.dateAdd)); // d. Let moveResult be ? MoveRelativeDate(calendar, relativeTo, oneWeek, dateAdd). auto move_result = TRY(move_relative_date(vm, *calendar, *relative_to, *one_week, date_add)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp index 3fb5ec4c90..f5f438f136 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp @@ -329,7 +329,7 @@ ThrowCompletionOr to_temporal_time_zone(VM& vm, Value temporal_time_zon ThrowCompletionOr get_offset_nanoseconds_for(VM& vm, Value time_zone, Instant& instant) { // 1. Let getOffsetNanosecondsFor be ? GetMethod(timeZone, "getOffsetNanosecondsFor"). - auto* get_offset_nanoseconds_for = TRY(time_zone.get_method(vm, vm.names.getOffsetNanosecondsFor)); + auto get_offset_nanoseconds_for = TRY(time_zone.get_method(vm, vm.names.getOffsetNanosecondsFor)); // 2. Let offsetNanoseconds be ? Call(getOffsetNanosecondsFor, timeZone, « instant »). auto offset_nanoseconds_value = TRY(call(vm, get_offset_nanoseconds_for, time_zone, &instant)); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index 53a2e43de9..7c9e7899f7 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -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/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index b89bdcf4c0..15f7d6a14e 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -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) { @@ -1228,7 +1228,7 @@ ThrowCompletionOr Value::get(VM& vm, PropertyKey const& property_key) con } // 7.3.11 GetMethod ( V, P ), https://tc39.es/ecma262/#sec-getmethod -ThrowCompletionOr Value::get_method(VM& vm, PropertyKey const& property_key) const +ThrowCompletionOr> Value::get_method(VM& vm, PropertyKey const& property_key) const { // 1. Assert: IsPropertyKey(P) is true. VERIFY(property_key.is_valid()); @@ -1245,7 +1245,7 @@ ThrowCompletionOr Value::get_method(VM& vm, PropertyKey const& return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, function.to_string_without_side_effects())); // 5. Return func. - return &function.as_function(); + return function.as_function(); } // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators @@ -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/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index 88a7c85cb9..e3c7f9ff7a 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -392,7 +392,7 @@ public: bool to_boolean() const; ThrowCompletionOr get(VM&, PropertyKey const&) const; - ThrowCompletionOr get_method(VM&, PropertyKey const&) const; + ThrowCompletionOr> get_method(VM&, PropertyKey const&) const; ErrorOr to_string_without_side_effects() const; diff --git a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp index afa1dbc4e9..c2ff582485 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)