Skip to content

Commit

Permalink
fix(transformer): remove an AstBuilder::copy call (#4983)
Browse files Browse the repository at this point in the history
Remove one usage of unsound `AstBuilder::copy` method, using the new `get_inner_expression_mut` method introduced in #4920.
  • Loading branch information
overlookmotel committed Aug 19, 2024
1 parent 4796ece commit edacf93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/typescript/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ impl<'a> TypeScriptAnnotations<'a> {

pub fn transform_expression(&mut self, expr: &mut Expression<'a>) {
if expr.is_typescript_syntax() {
// SAFETY: `ast.copy` is unsound! We need to fix.
*expr = unsafe { self.ctx.ast.copy(expr.get_inner_expression()) };
let inner_expr = expr.get_inner_expression_mut();
*expr = self.ctx.ast.move_expression(inner_expr);
}
}

Expand Down

0 comments on commit edacf93

Please sign in to comment.