mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(transformer): remove an AstBuilder::copy call from TS namespace transform (#4987)
Replace an unsafe `AstBuilder::copy` call with `AstBuilder::move_expression` in TS namespace transform.
This commit is contained in:
parent
a8dfddaeab
commit
6ffbd78947
1 changed files with 2 additions and 3 deletions
|
|
@ -460,7 +460,7 @@ impl<'a> TypeScript<'a> {
|
|||
let Some(property_name) = declarator.id.get_identifier() else {
|
||||
return;
|
||||
};
|
||||
if let Some(init) = &declarator.init {
|
||||
if let Some(init) = &mut declarator.init {
|
||||
declarator.init = Some(
|
||||
self.ctx.ast.expression_assignment(
|
||||
SPAN,
|
||||
|
|
@ -476,8 +476,7 @@ impl<'a> TypeScript<'a> {
|
|||
),
|
||||
)
|
||||
.into(),
|
||||
// SAFETY: `ast.copy` is unsound! We need to fix.
|
||||
unsafe { self.ctx.ast.copy(init) },
|
||||
self.ctx.ast.move_expression(init),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue