mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(transformer/async-generator-functions): do not transform yield expression where inside generator function (#7134)
This commit is contained in:
parent
2c5734d49b
commit
cd1006fec1
5 changed files with 12 additions and 2 deletions
|
|
@ -200,7 +200,7 @@ impl<'a, 'ctx> AsyncGeneratorFunctions<'a, 'ctx> {
|
||||||
expr: &mut YieldExpression<'a>,
|
expr: &mut YieldExpression<'a>,
|
||||||
ctx: &mut TraverseCtx<'a>,
|
ctx: &mut TraverseCtx<'a>,
|
||||||
) -> Option<Expression<'a>> {
|
) -> Option<Expression<'a>> {
|
||||||
if !expr.delegate {
|
if !expr.delegate || !Self::is_inside_async_generator_function(ctx) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
commit: d20b314c
|
commit: d20b314c
|
||||||
|
|
||||||
Passed: 75/84
|
Passed: 76/85
|
||||||
|
|
||||||
# All Passed:
|
# All Passed:
|
||||||
* babel-plugin-transform-class-static-block
|
* babel-plugin-transform-class-static-block
|
||||||
* babel-plugin-transform-nullish-coalescing-operator
|
* babel-plugin-transform-nullish-coalescing-operator
|
||||||
* babel-plugin-transform-optional-catch-binding
|
* babel-plugin-transform-optional-catch-binding
|
||||||
|
* babel-plugin-transform-async-generator-functions
|
||||||
* babel-plugin-transform-async-to-generator
|
* babel-plugin-transform-async-to-generator
|
||||||
* babel-plugin-transform-exponentiation-operator
|
* babel-plugin-transform-exponentiation-operator
|
||||||
* babel-plugin-transform-arrow-functions
|
* babel-plugin-transform-arrow-functions
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
function* x() { yield* /z/ }
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
function* x() {
|
||||||
|
yield* /z/;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"transform-async-generator-functions"
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue