mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(transformer): remove unreachable code from TS namespace transform (#3475)
As discussed in https://github.com/oxc-project/oxc/pull/3468#discussion_r1619782711, `export {x}` is not legal inside a TS namespace. So remove the code which handles this impossible case.
This commit is contained in:
parent
0f4bcc0a68
commit
deef86aff2
1 changed files with 2 additions and 7 deletions
|
|
@ -227,6 +227,8 @@ impl<'a> TypeScript<'a> {
|
|||
new_stmts.push(Statement::VariableDeclaration(decl));
|
||||
}
|
||||
Statement::ExportNamedDeclaration(export_decl) => {
|
||||
// NB: `ExportNamedDeclaration` with no declaration (e.g. `export {x}`) is not
|
||||
// legal syntax in TS namespaces
|
||||
let export_decl = export_decl.unbox();
|
||||
if let Some(decl) = export_decl.declaration {
|
||||
if decl.modifiers().is_some_and(Modifiers::is_contains_declare) {
|
||||
|
|
@ -294,13 +296,6 @@ impl<'a> TypeScript<'a> {
|
|||
}
|
||||
_ => {}
|
||||
}
|
||||
} else {
|
||||
let stmt = self.ctx.ast.module_declaration(
|
||||
ModuleDeclaration::ExportNamedDeclaration(
|
||||
self.ctx.ast.alloc(export_decl),
|
||||
),
|
||||
);
|
||||
new_stmts.push(stmt);
|
||||
}
|
||||
}
|
||||
stmt => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue