Skip to content

Return completions when yield* is used #20

Closed as not planned
Closed as not planned
@anba

Description

@anba
var it = Iterator.concat({
  [Symbol.iterator]() { return this; },
  next() { console.log("next"); return {done: false}; },
  return() { console.log("return"); return {done: false}; },
});

Before #18:

js> it.next()
next
({value:(void 0), done:false})
js> it.return()
return
({value:(void 0), done:true})
js> it.return()
({value:(void 0), done:true})

When using yield* semantics:

js> it.next()
next
({done:false})
js> it.return()
return
({done:false})
js> it.return()
return
({done:false})

But the current spec requires something in between, because per spec return completions must always close the iterator, whereas yield* allows to continue after return completions.

After #18:

s> it.next()
next
({done:false})
js> it.return()
return
({value:(void 0), done:true})
js> it.return()
({value:(void 0), done:true})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions