Skip to content

semantics of yield* in throw case #293

Closed
@GeorgNeis

Description

@GeorgNeis

In the semantics of yield* (14.4.14) in step 5.b.ii.5.b (the throw case), it returns a return completion record.

If I understand correctly, this means that if I define

function* inner() { try {yield 1} catch(e) {return}; yield 2 }
function* outer() { yield* inner(); yield 3 }
x = outer()

then I should get the following interaction:

> x.next()
{value: 1, done: false}
> x.throw("bla")
{value: undefined, done: true}

Is this intended?

V8 and Firefox behave as if 5.b.ii.5.b would just return a normal completion (like in 5.a.iii):

> x.next()
{value: 1, done: false}
> x.throw("bla")
{value: 3, done: false}

Edge does something else entirely:

> x.next()
{value: 1, done: false}
> x.throw("bla")
Exception: bla

Metadata

Metadata

Assignees

No one assigned

    Labels

    normative changeAffects behavior required to correctly evaluate some ECMAScript source text

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions