refactor(transformer/async-generator-functions): do not transform yield expression where inside generator function (#7134)

This commit is contained in:
Dunqing 2024-11-06 03:27:13 +00:00
parent 2c5734d49b
commit cd1006fec1
5 changed files with 12 additions and 2 deletions

View file

@ -200,7 +200,7 @@ impl<'a, 'ctx> AsyncGeneratorFunctions<'a, 'ctx> {
expr: &mut YieldExpression<'a>,
ctx: &mut TraverseCtx<'a>,
) -> Option<Expression<'a>> {
if !expr.delegate {
if !expr.delegate || !Self::is_inside_async_generator_function(ctx) {
return None;
}

View file

@ -1,11 +1,12 @@
commit: d20b314c
Passed: 75/84
Passed: 76/85
# All Passed:
* babel-plugin-transform-class-static-block
* babel-plugin-transform-nullish-coalescing-operator
* babel-plugin-transform-optional-catch-binding
* babel-plugin-transform-async-generator-functions
* babel-plugin-transform-async-to-generator
* babel-plugin-transform-exponentiation-operator
* babel-plugin-transform-arrow-functions

View file

@ -0,0 +1,5 @@
{
"plugins": [
"transform-async-generator-functions"
]
}