-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Bug Report
Manually return an async generator with yield* in a inner loop it will remain to yield.
Input Code
async function* func1()
{
yield await "yield 1"
yield await "yield 2"
yield await "yield 3"
}
async function* func2()
{
let i = 5
while (i--) // Inner loop here
{
yield* await func1()
}
}
(async () =>
{
const iterator = func2();
for await (let item of iterator)
{
console.log(item)
iterator.return() // manual return at first iteration
}
})()Expected behavior/code
logs
yield 1
Current Behavior
logs
yield 1
yield 2
yield 2
yield 2
yield 2
Babel Configuration (.babelrc, package.json, cli command)
{
"plugins": [
[
"@babel/plugin-transform-runtime"
]
],
"presets": [
[
"@babel/preset-env",
{
"targets": {
"ie": "11"
}
}
]
]
}Environment
- Babel version(s): 7.3.4
- Node/npm version: v10.14.1
- OS: Windows 10
- How you are using Babel: With ParcelJS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue