fixed Array.prototype.iter(..)

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-06-27 04:36:57 +03:00
parent 1cc4e127f2
commit 7f80627670
2 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,9 @@ var STOP =
module.STOP =
object.STOP
var stoppable =
module.stoppable =
generator.stoppable
//---------------------------------------------------------------------
@ -492,7 +495,7 @@ object.Mixin('ArrayProtoMixin', 'soft', {
// XXX this should handle throwing STOP!!!
// ...might also ne a good idea to isolate the STOP mechanics
// into a spearate module/package...
iter: function*(handler=undefined){
iter: stoppable(function*(handler=undefined){
if(handler){
var i = 0
for(var e of this){
@ -504,7 +507,7 @@ object.Mixin('ArrayProtoMixin', 'soft', {
} else {
yield res } }
} else {
yield* this }},
yield* this }}),
// Stoppable iteration...

View File

@ -86,6 +86,7 @@ var ITERATOR_PROTOTYPES = [
//---------------------------------------------------------------------
// XXX should this be part of object???
var stoppable =
module.stoppable =
function(func){