Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

[bug] yield* with .return() on parent, missed child's finally block execution #275

@Andarist

Description

@Andarist

The following code does not transform as expected:

function* saga(){
    try {
        yield* worker()
    } finally {
        console.log('parent > exit')
    }
}

function* worker(){
    try {
        yield 1 // just stop here
    } finally {
        yield 2
        console.log('child > exit')
    }
}

var t = saga()
t.next() // meet the stoping point
t.return()
t.next()

If we run this code in Chrome's console we'll get the following logs:

console.log('child > exit')
console.log('parent > exit')

but with regenerator the outcome is only this

console.log('parent > exit')

I would be happy to help with fixing this, but at least pointing some starting points in the codebase would be great, as it is not the easiest project to grasp at once

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions