Bläddra i källkod

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

This is in alignment with the spec.
Timothy Flynn 3 år sedan
förälder
incheckning
f4c8f2102f
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp

+ 3 - 2
Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp

@@ -6,6 +6,7 @@
 
 
 #include <LibJS/Runtime/AbstractOperations.h>
 #include <LibJS/Runtime/AbstractOperations.h>
 #include <LibJS/Runtime/Error.h>
 #include <LibJS/Runtime/Error.h>
+#include <LibJS/Runtime/FunctionObject.h>
 #include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/IteratorOperations.h>
 #include <LibJS/Runtime/IteratorOperations.h>
 
 
@@ -18,8 +19,8 @@ ThrowCompletionOr<Object*> get_iterator(GlobalObject& global_object, Value value
     if (method.is_empty()) {
     if (method.is_empty()) {
         if (hint == IteratorHint::Async)
         if (hint == IteratorHint::Async)
             TODO();
             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())
     if (!method.is_function())