1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:47:36 +00:00

LibJS: Retrieve GetIterator's optional 'method' function using GetMethod

This is in alignment with the spec.
This commit is contained in:
Timothy Flynn 2021-10-20 14:47:14 -04:00 committed by Linus Groh
parent 860a37640b
commit f4c8f2102f

View file

@ -6,6 +6,7 @@
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/IteratorOperations.h>
@ -18,8 +19,8 @@ ThrowCompletionOr<Object*> get_iterator(GlobalObject& global_object, Value value
if (method.is_empty()) {
if (hint == IteratorHint::Async)
TODO();
auto object = TRY(value.to_object(global_object));
method = TRY(object->get(*vm.well_known_symbol_iterator()));
method = TRY(value.get_method(global_object, *vm.well_known_symbol_iterator()));
}
if (!method.is_function())