Timothy Flynn
fb228a3d85
LibJS: Implement Iterator.prototype.constructor according to spec
...
The spec allows setting a constructor on non built-in Iterator objects.
This is a normative change in the Iterator Helpers proposal. See:
30b3501
2024-07-18 14:49:25 +02:00
Timothy Flynn
734e37442d
LibJS: Implement Iterator.prototype [ @@toStringTag ] according to spec
...
The spec allows setting the prototype on non built-in Iterator objects.
This is a normative change in the Iterator Helpers proposal. See:
30b3501
2024-07-18 14:49:25 +02:00
Timothy Flynn
0e63d04a35
LibJS: Implement %IteratorHelperPrototype%.return
2023-07-16 23:56:55 +01:00
Timothy Flynn
705e96568c
LibJS: Change error message for non-objects in GetIteratorFlattenable
...
Matches other usages in e.g. Temporal now.
2023-07-12 23:57:41 +02:00
Timothy Flynn
ff4e0d2943
LibJS: Avoid creating String object wrappers in iterator helpers
...
This is a normative change in the Iterator Helpers spec. See:
3e275cf
2023-07-12 23:26:51 +02:00
Timothy Flynn
6fb670c1c2
LibJS: Implement Iterator.prototype.find
2023-06-26 10:39:07 +02:00
Timothy Flynn
1f05b0638f
LibJS: Implement Iterator.prototype.every
2023-06-26 10:39:07 +02:00
Timothy Flynn
6ac1d5afae
LibJS: Implement Iterator.prototype.some
2023-06-26 10:39:07 +02:00
Timothy Flynn
134bb44ca0
LibJS: Implement Iterator.prototype.forEach
2023-06-26 10:39:07 +02:00
Timothy Flynn
35380b2aef
LibJS: Implement Iterator.prototype.toArray
2023-06-26 10:39:07 +02:00
Timothy Flynn
acc05480e8
LibJS: Implement Iterator.prototype.reduce
2023-06-26 10:39:07 +02:00
Timothy Flynn
ad42b4ea67
LibJS: Implement Iterator.prototype.flatMap
...
This prototype is a bit tricky in that we need to maintain the iteration
state of the mapped iterator's inner iterator as we return values to the
caller. To do this, we create a FlatMapIterator helper to perform the
steps that apply to the current iteration state.
2023-06-26 10:39:07 +02:00
Timothy Flynn
67028ee3a3
LibJS: Implement Iterator.prototype.drop
2023-06-26 10:39:07 +02:00
Timothy Flynn
0e2f9f006d
LibJS: Implement Iterator.prototype.take
2023-06-26 10:39:07 +02:00
Timothy Flynn
deeee65e37
LibJS: Implement Iterator.prototype.filter
2023-06-26 10:39:07 +02:00
Timothy Flynn
3eb2e4e08a
LibJS: Implement Iterator.prototype.map
...
This uses a new Iterator type called IteratorHelper. This does not
implement IteratorHelper.prototype.return as that relies on generator
objects (i.e. the internal slots of JS::GeneratorObject), which are not
hooked up here.
2023-06-26 10:39:07 +02:00
Timothy Flynn
7ff6b472c0
LibJS: Implement Iterator.prototype [ @@toStringTag ]
2023-06-26 10:39:07 +02:00
Timothy Flynn
d9d245faa7
LibJS: Implement Iterator.from and the WrapForValidIteratorPrototype
...
Iterator.from creates an Iterator from either an existing iterator or
an iterator-like object. In the latter case, it sets the prototype of
the returned iterator to WrapForValidIteratorPrototype to wrap around
the iterator-like object's iteration methods.
2023-06-26 10:39:07 +02:00
Timothy Flynn
5736b53013
LibJS: Add an Iterator constructor and object
...
The Iterator object cannot be constructed directly but can be subclassed
or created with `Iterator.from` (not implemented here).
2023-06-26 10:39:07 +02:00