Skip to content

Commit

Permalink
refactor(transformer/async-generator-functions): do not transform yie…
Browse files Browse the repository at this point in the history
…ld expression where inside generator function (#7134)
  • Loading branch information
Dunqing committed Nov 6, 2024
1 parent 2c5734d commit cd1006f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion tasks/transform_conformance/snapshots/oxc.snap.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function* x() { yield* /z/ }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function* x() {
yield* /z/;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": [
"transform-async-generator-functions"
]
}

0 comments on commit cd1006f

Please sign in to comment.