mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(transformer): simplify TS export assignment transform (#3762)
Remove unnecessary jump through a `ModuleDeclaration` visitor, and visit as `TSExportAssignment` directly.
This commit is contained in:
parent
512740d33d
commit
cd56aa9dd8
2 changed files with 3 additions and 9 deletions
|
|
@ -284,11 +284,11 @@ impl<'a> Traverse<'a> for Transformer<'a> {
|
|||
self.x0_typescript.transform_for_statement(stmt);
|
||||
}
|
||||
|
||||
fn enter_module_declaration(
|
||||
fn enter_ts_export_assignment(
|
||||
&mut self,
|
||||
decl: &mut ModuleDeclaration<'a>,
|
||||
export_assignment: &mut TSExportAssignment<'a>,
|
||||
_ctx: &mut TraverseCtx<'a>,
|
||||
) {
|
||||
self.x0_typescript.transform_module_declaration(decl);
|
||||
self.x0_typescript.transform_ts_export_assignment(export_assignment);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,12 +189,6 @@ impl<'a> TypeScript<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn transform_module_declaration(&mut self, module_decl: &mut ModuleDeclaration<'a>) {
|
||||
if let ModuleDeclaration::TSExportAssignment(ts_export_assignment) = &mut *module_decl {
|
||||
self.transform_ts_export_assignment(ts_export_assignment);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn transform_jsx_element(&mut self, elem: &mut JSXElement<'a>) {
|
||||
self.annotations.transform_jsx_element(elem);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue