mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:47:35 +00:00
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.
This commit is contained in:
parent
5736b53013
commit
d9d245faa7
11 changed files with 299 additions and 0 deletions
|
@ -29,6 +29,7 @@ public:
|
|||
NonnullGCPtr<Object> async_from_sync_iterator_prototype() { return *m_async_from_sync_iterator_prototype; }
|
||||
NonnullGCPtr<Object> async_generator_prototype() { return *m_async_generator_prototype; }
|
||||
NonnullGCPtr<Object> generator_prototype() { return *m_generator_prototype; }
|
||||
NonnullGCPtr<Object> wrap_for_valid_iterator_prototype() { return *m_wrap_for_valid_iterator_prototype; }
|
||||
|
||||
// Alias for the AsyncGenerator Prototype Object used by the spec (%AsyncGeneratorFunction.prototype.prototype%)
|
||||
NonnullGCPtr<Object> async_generator_function_prototype_prototype() { return *m_async_generator_prototype; }
|
||||
|
@ -128,6 +129,7 @@ private:
|
|||
GCPtr<Object> m_async_from_sync_iterator_prototype;
|
||||
GCPtr<Object> m_async_generator_prototype;
|
||||
GCPtr<Object> m_generator_prototype;
|
||||
GCPtr<Object> m_wrap_for_valid_iterator_prototype;
|
||||
|
||||
// Not included in JS_ENUMERATE_INTL_OBJECTS due to missing distinct constructor
|
||||
GCPtr<Object> m_intl_segments_prototype;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue