get-value-after-done.js (916B)
1 // |reftest| shell-option(--enable-iterator-sequencing) skip-if(!Iterator.concat||!xulRuntime.shell) -- iterator-sequencing is not enabled unconditionally, requires shell-options 2 // Copyright (C) 2025 Michael Ficarra. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-iterator.concat 7 description: > 8 Iterator.concat does not access the value of a done IteratorResult, diverging from the behaviour of yield* 9 features: [iterator-sequencing] 10 ---*/ 11 12 let valueAccesses = 0; 13 let iter = { 14 [Symbol.iterator]() { 15 return { 16 next() { 17 return { 18 get value() { 19 ++valueAccesses; 20 }, 21 done: true, 22 }; 23 }, 24 }; 25 } 26 }; 27 28 Array.from(Iterator.concat(iter, iter, iter)); 29 30 assert.sameValue(valueAccesses, 0, 'Iterator.concat does not access value getter after each iterator is done'); 31 32 reportCompare(0, 0);