diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-07-07 11:55:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-07 11:55:43 +0200 |
commit | 1af00389dfb9ea52a1a0ee94a5c4618a647bb6ec (patch) | |
tree | 2eb4027eba5468c0dd0b8cb8bba85182c675a04b /js/src/builtin/Iterator.js | |
parent | e9f79994278968cc86698a7d90e05ca01201c441 (diff) | |
parent | 941e54654eabed0a3568f7fefe424a45aa02eddb (diff) | |
download | UXP-1af00389dfb9ea52a1a0ee94a5c4618a647bb6ec.tar UXP-1af00389dfb9ea52a1a0ee94a5c4618a647bb6ec.tar.gz UXP-1af00389dfb9ea52a1a0ee94a5c4618a647bb6ec.tar.lz UXP-1af00389dfb9ea52a1a0ee94a5c4618a647bb6ec.tar.xz UXP-1af00389dfb9ea52a1a0ee94a5c4618a647bb6ec.zip |
Merge pull request #608 from janekptacijarabaci/_testBranch_js_modules_basic
Merge branch js modules basic
Diffstat (limited to 'js/src/builtin/Iterator.js')
-rw-r--r-- | js/src/builtin/Iterator.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/js/src/builtin/Iterator.js b/js/src/builtin/Iterator.js index 735eec7a0..e25b76156 100644 --- a/js/src/builtin/Iterator.js +++ b/js/src/builtin/Iterator.js @@ -84,44 +84,3 @@ function LegacyIteratorShim() { function LegacyGeneratorIteratorShim() { return NewLegacyIterator(ToObject(this), LegacyGeneratorIterator); } - -// 7.4.8 CreateListIterator() -function CreateListIterator(array) { - let iterator = NewListIterator(); - UnsafeSetReservedSlot(iterator, ITERATOR_SLOT_TARGET, array); - UnsafeSetReservedSlot(iterator, ITERATOR_SLOT_NEXT_INDEX, 0); - - // 7.4.8.1 ListIterator next() - // The spec requires that we use a new next function per iterator object. - let next = function() { - if (!IsObject(this) || !IsListIterator(this)) - return callFunction(CallListIteratorMethodIfWrapped, this, "ListIteratorNext"); - - if (ActiveFunction() !== UnsafeGetReservedSlot(this, ITERATOR_SLOT_NEXT_METHOD)) - ThrowTypeError(JSMSG_INCOMPATIBLE_METHOD, "next", "method", ToString(this)); - - let array = UnsafeGetObjectFromReservedSlot(this, ITERATOR_SLOT_TARGET); - let index = UnsafeGetReservedSlot(this, ITERATOR_SLOT_NEXT_INDEX); - - if (index >= ToLength(array.length)) { - UnsafeSetReservedSlot(this, ITERATOR_SLOT_NEXT_INDEX, 1/0); - return { value: undefined, done: true }; - } - - UnsafeSetReservedSlot(this, ITERATOR_SLOT_NEXT_INDEX, index + 1); - return { value: array[index], done: false }; - }; - - UnsafeSetReservedSlot(iterator, ITERATOR_SLOT_NEXT_METHOD, next); - iterator.next = next; - - iterator[std_iterator] = ListIteratorIdentity; - return iterator; -} - -function ListIteratorIdentity() { - if (!IsObject(this) || !IsListIterator(this)) - return callFunction(CallListIteratorMethodIfWrapped, this, "ListIteratorIdentity"); - - return this; -} |