mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
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.
This commit is contained in:
parent
b84f8fb55b
commit
2555d7a36a
78 changed files with 122 additions and 121 deletions
|
@ -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
|
||||
*/
|
||||
|
@ -24,12 +24,12 @@ ThrowCompletionOr<Iterator> 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<Iterator> 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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue