diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
3 files changed, 9 insertions, 9 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp index f864bd4c56..aed9489476 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp @@ -87,12 +87,12 @@ JS_DEFINE_NATIVE_FUNCTION(AsyncFromSyncIteratorPrototype::next) // 6. Else, // a. Let result be Completion(IteratorNext(syncIteratorRecord)). // 7. IfAbruptRejectPromise(result, promiseCapability). - auto* result = TRY_OR_REJECT(vm, promise_capability, + auto result = TRY_OR_REJECT(vm, promise_capability, (vm.argument_count() > 0 ? iterator_next(vm, sync_iterator_record, vm.argument(0)) : iterator_next(vm, sync_iterator_record))); // 8. Return AsyncFromSyncIteratorContinuation(result, promiseCapability). - return async_from_sync_iterator_continuation(vm, *result, promise_capability); + return async_from_sync_iterator_continuation(vm, result, promise_capability); } // 27.1.4.2.2 %AsyncFromSyncIteratorPrototype%.return ( [ value ] ), https://tc39.es/ecma262/#sec-%asyncfromsynciteratorprototype%.return diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp index 369fd3d2cd..c93f052f6d 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -68,7 +68,7 @@ ThrowCompletionOr<Iterator> get_iterator(VM& vm, Value value, IteratorHint hint, } // 7.4.3 IteratorNext ( iteratorRecord [ , value ] ), https://tc39.es/ecma262/#sec-iteratornext -ThrowCompletionOr<Object*> iterator_next(VM& vm, Iterator const& iterator_record, Optional<Value> value) +ThrowCompletionOr<NonnullGCPtr<Object>> iterator_next(VM& vm, Iterator const& iterator_record, Optional<Value> value) { Value result; @@ -86,7 +86,7 @@ ThrowCompletionOr<Object*> iterator_next(VM& vm, Iterator const& iterator_record return vm.throw_completion<TypeError>(ErrorType::IterableNextBadReturn); // 4. Return result. - return &result.as_object(); + return result.as_object(); } // 7.4.4 IteratorComplete ( iterResult ), https://tc39.es/ecma262/#sec-iteratorcomplete @@ -107,17 +107,17 @@ ThrowCompletionOr<Value> iterator_value(VM& vm, Object& iterator_result) ThrowCompletionOr<Object*> iterator_step(VM& vm, Iterator const& iterator_record) { // 1. Let result be ? IteratorNext(iteratorRecord). - auto* result = TRY(iterator_next(vm, iterator_record)); + auto result = TRY(iterator_next(vm, iterator_record)); // 2. Let done be ? IteratorComplete(result). - auto done = TRY(iterator_complete(vm, *result)); + auto done = TRY(iterator_complete(vm, result)); // 3. If done is true, return false. if (done) return nullptr; // 4. Return result. - return result; + return result.ptr(); } // 7.4.7 IteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-iteratorclose diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.h b/Userland/Libraries/LibJS/Runtime/IteratorOperations.h index e6458843a4..b8808975ae 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.h +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org> - * Copyright (c) 2022, Linus Groh <linusg@serenityos.org> + * Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -23,7 +23,7 @@ enum class IteratorHint { }; ThrowCompletionOr<Iterator> get_iterator(VM&, Value, IteratorHint = IteratorHint::Sync, Optional<Value> method = {}); -ThrowCompletionOr<Object*> iterator_next(VM&, Iterator const&, Optional<Value> = {}); +ThrowCompletionOr<NonnullGCPtr<Object>> iterator_next(VM&, Iterator const&, Optional<Value> = {}); ThrowCompletionOr<Object*> iterator_step(VM&, Iterator const&); ThrowCompletionOr<bool> iterator_complete(VM&, Object& iterator_result); ThrowCompletionOr<Value> iterator_value(VM&, Object& iterator_result); |