mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
LibJS: Replace iterator hint string argument with an enum
There's no reason at all for this to be a string or to accept arbitrary values - just because it's displayed as strings in the spec doesn't mean we have to do the same :^)
This commit is contained in:
parent
a5903ac4b6
commit
163d776df6
3 changed files with 10 additions and 6 deletions
|
@ -10,12 +10,11 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
Object* get_iterator(GlobalObject& global_object, Value value, String hint, Value method)
|
||||
Object* get_iterator(GlobalObject& global_object, Value value, IteratorHint hint, Value method)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
VERIFY(hint == "sync" || hint == "async");
|
||||
if (method.is_empty()) {
|
||||
if (hint == "async")
|
||||
if (hint == IteratorHint::Async)
|
||||
TODO();
|
||||
auto object = value.to_object(global_object);
|
||||
if (!object)
|
||||
|
@ -100,7 +99,7 @@ void get_iterator_values(GlobalObject& global_object, Value value, AK::Function<
|
|||
{
|
||||
auto& vm = global_object.vm();
|
||||
|
||||
auto iterator = get_iterator(global_object, value, "sync", method);
|
||||
auto iterator = get_iterator(global_object, value, IteratorHint::Sync, method);
|
||||
if (!iterator)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue