summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-02-18 08:46:32 -0500
committerLinus Groh <mail@linusgroh.de>2022-02-18 13:57:34 +0000
commit257518424263b12a959f2196f3efef6300aa53cb (patch)
tree8e3748fa326ef3b82755775cc3b2d930a4864bda /Userland/Libraries/LibJS
parent2c6183da1ee9026a321dd4cd212891b8ca4ae0fe (diff)
downloadserenity-257518424263b12a959f2196f3efef6300aa53cb.zip
LibJS: Add a spec link for Iterator Records
This is an editorial change to the spec to strongly define this record: https://github.com/tc39/ecma262/commit/85d910c
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Iterator.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp22
2 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Iterator.h b/Userland/Libraries/LibJS/Runtime/Iterator.h
index 54e2557966..4be4d65083 100644
--- a/Userland/Libraries/LibJS/Runtime/Iterator.h
+++ b/Userland/Libraries/LibJS/Runtime/Iterator.h
@@ -11,7 +11,7 @@
namespace JS {
-// Iterator Record
+// 7.4.1 Iterator Records, https://tc39.es/ecma262/#sec-iterator-records
struct Iterator {
Object* iterator { nullptr }; // [[Iterator]]
Value next_method; // [[NextMethod]]
diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp
index b8a575004a..dd4303eaf5 100644
--- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp
+++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp
@@ -14,7 +14,7 @@
namespace JS {
-// 7.4.1 GetIterator ( obj [ , hint [ , method ] ] ), https://tc39.es/ecma262/#sec-getiterator
+// 7.4.2 GetIterator ( obj [ , hint [ , method ] ] ), https://tc39.es/ecma262/#sec-getiterator
ThrowCompletionOr<Iterator> get_iterator(GlobalObject& global_object, Value value, IteratorHint hint, Optional<Value> method)
{
auto& vm = global_object.vm();
@@ -69,7 +69,7 @@ ThrowCompletionOr<Iterator> get_iterator(GlobalObject& global_object, Value valu
return iterator_record;
}
-// 7.4.2 IteratorNext ( iteratorRecord [ , value ] ), https://tc39.es/ecma262/#sec-iteratornext
+// 7.4.3 IteratorNext ( iteratorRecord [ , value ] ), https://tc39.es/ecma262/#sec-iteratornext
ThrowCompletionOr<Object*> iterator_next(GlobalObject& global_object, Iterator const& iterator_record, Optional<Value> value)
{
auto& vm = global_object.vm();
@@ -93,7 +93,7 @@ ThrowCompletionOr<Object*> iterator_next(GlobalObject& global_object, Iterator c
return &result.as_object();
}
-// 7.4.3 IteratorComplete ( iterResult ), https://tc39.es/ecma262/#sec-iteratorcomplete
+// 7.4.4 IteratorComplete ( iterResult ), https://tc39.es/ecma262/#sec-iteratorcomplete
ThrowCompletionOr<bool> iterator_complete(GlobalObject& global_object, Object& iterator_result)
{
auto& vm = global_object.vm();
@@ -102,7 +102,7 @@ ThrowCompletionOr<bool> iterator_complete(GlobalObject& global_object, Object& i
return TRY(iterator_result.get(vm.names.done)).to_boolean();
}
-// 7.4.4 IteratorValue ( iterResult ), https://tc39.es/ecma262/#sec-iteratorvalue
+// 7.4.5 IteratorValue ( iterResult ), https://tc39.es/ecma262/#sec-iteratorvalue
ThrowCompletionOr<Value> iterator_value(GlobalObject& global_object, Object& iterator_result)
{
auto& vm = global_object.vm();
@@ -111,7 +111,7 @@ ThrowCompletionOr<Value> iterator_value(GlobalObject& global_object, Object& ite
return TRY(iterator_result.get(vm.names.value));
}
-// 7.4.5 IteratorStep ( iteratorRecord ), https://tc39.es/ecma262/#sec-iteratorstep
+// 7.4.6 IteratorStep ( iteratorRecord ), https://tc39.es/ecma262/#sec-iteratorstep
ThrowCompletionOr<Object*> iterator_step(GlobalObject& global_object, Iterator const& iterator_record)
{
// 1. Let result be ? IteratorNext(iteratorRecord).
@@ -128,8 +128,8 @@ ThrowCompletionOr<Object*> iterator_step(GlobalObject& global_object, Iterator c
return result;
}
-// 7.4.6 IteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-iteratorclose
-// 7.4.8 AsyncIteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-asynciteratorclose
+// 7.4.7 IteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-iteratorclose
+// 7.4.9 AsyncIteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-asynciteratorclose
// NOTE: These only differ in that async awaits the inner value after the call.
static Completion iterator_close_impl(GlobalObject& global_object, Iterator const& iterator_record, Completion completion, IteratorHint iterator_hint)
{
@@ -181,19 +181,19 @@ static Completion iterator_close_impl(GlobalObject& global_object, Iterator cons
return completion;
}
-// 7.4.6 IteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-iteratorclose
+// 7.4.7 IteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-iteratorclose
Completion iterator_close(GlobalObject& global_object, Iterator const& iterator_record, Completion completion)
{
return iterator_close_impl(global_object, iterator_record, move(completion), IteratorHint::Sync);
}
-// 7.4.8 AsyncIteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-asynciteratorclose
+// 7.4.9 AsyncIteratorClose ( iteratorRecord, completion ), https://tc39.es/ecma262/#sec-asynciteratorclose
Completion async_iterator_close(GlobalObject& global_object, Iterator const& iterator_record, Completion completion)
{
return iterator_close_impl(global_object, iterator_record, move(completion), IteratorHint::Async);
}
-// 7.4.9 CreateIterResultObject ( value, done ), https://tc39.es/ecma262/#sec-createiterresultobject
+// 7.4.10 CreateIterResultObject ( value, done ), https://tc39.es/ecma262/#sec-createiterresultobject
Object* create_iterator_result_object(GlobalObject& global_object, Value value, bool done)
{
auto& vm = global_object.vm();
@@ -211,7 +211,7 @@ Object* create_iterator_result_object(GlobalObject& global_object, Value value,
return object;
}
-// 7.4.11 IterableToList ( items [ , method ] ), https://tc39.es/ecma262/#sec-iterabletolist
+// 7.4.12 IterableToList ( items [ , method ] ), https://tc39.es/ecma262/#sec-iterabletolist
ThrowCompletionOr<MarkedVector<Value>> iterable_to_list(GlobalObject& global_object, Value iterable, Optional<Value> method)
{
auto& vm = global_object.vm();