1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +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:
Linus Groh 2021-06-02 20:52:46 +01:00
parent a5903ac4b6
commit 163d776df6
3 changed files with 10 additions and 6 deletions

View file

@ -14,7 +14,12 @@ namespace JS {
// Common iterator operations defined in ECMA262 7.4
// https://tc39.es/ecma262/#sec-operations-on-iterator-objects
Object* get_iterator(GlobalObject&, Value value, String hint = "sync", Value method = {});
enum class IteratorHint {
Sync,
Async,
};
Object* get_iterator(GlobalObject&, Value value, IteratorHint hint = IteratorHint::Sync, Value method = {});
bool is_iterator_complete(Object& iterator_result);
Value create_iterator_result_object(GlobalObject&, Value value, bool done);