Skip to content

Commit

Permalink
fix(transformer/react): mismatch output caused by incorrect transform…
Browse files Browse the repository at this point in the history
…ation ordering
  • Loading branch information
Dunqing committed Aug 27, 2024
1 parent 681bd80 commit 7a1a3eb
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 198 deletions.
1 change: 1 addition & 0 deletions crates/oxc_transformer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ impl<'a> Traverse<'a> for Transformer<'a> {

fn exit_function(&mut self, func: &mut Function<'a>, ctx: &mut TraverseCtx<'a>) {
self.x0_typescript.transform_function(func);
self.x1_react.transform_function_on_exit(func, ctx);
self.x3_es2015.exit_function(func, ctx);
}

Expand Down
10 changes: 10 additions & 0 deletions crates/oxc_transformer/src/react/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,14 @@ impl<'a> React<'a> {
self.refresh.transform_expression_on_exit(expr, ctx);
}
}

pub fn transform_function_on_exit(
&mut self,
func: &mut Function<'a>,
ctx: &mut TraverseCtx<'a>,
) {
if self.refresh_plugin {
self.refresh.transform_function_on_exit(func, ctx);
}
}
}
Loading

0 comments on commit 7a1a3eb

Please sign in to comment.