Dunqing 2024-06-14 14:40:37 +08:00 committed by GitHub
parent e148a32ce3
commit 0578ece6a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 3 additions and 12 deletions

View file

@ -3315,7 +3315,6 @@ pub enum ExportDefaultDeclarationKind<'a> {
ClassDeclaration(Box<'a, Class<'a>>) = 65, ClassDeclaration(Box<'a, Class<'a>>) = 65,
TSInterfaceDeclaration(Box<'a, TSInterfaceDeclaration<'a>>) = 66, TSInterfaceDeclaration(Box<'a, TSInterfaceDeclaration<'a>>) = 66,
TSEnumDeclaration(Box<'a, TSEnumDeclaration<'a>>) = 67,
// `Expression` variants added here by `inherit_variants!` macro // `Expression` variants added here by `inherit_variants!` macro
@inherit Expression @inherit Expression
@ -3328,7 +3327,7 @@ impl<'a> ExportDefaultDeclarationKind<'a> {
match self { match self {
Self::FunctionDeclaration(func) => func.is_typescript_syntax(), Self::FunctionDeclaration(func) => func.is_typescript_syntax(),
Self::ClassDeclaration(class) => class.is_typescript_syntax(), Self::ClassDeclaration(class) => class.is_typescript_syntax(),
Self::TSInterfaceDeclaration(_) | Self::TSEnumDeclaration(_) => true, Self::TSInterfaceDeclaration(_) => true,
_ => false, _ => false,
} }
} }

View file

@ -565,7 +565,6 @@ impl<'a> GetSpan for ExportDefaultDeclarationKind<'a> {
match self { match self {
Self::ClassDeclaration(x) => x.span, Self::ClassDeclaration(x) => x.span,
Self::FunctionDeclaration(x) => x.span, Self::FunctionDeclaration(x) => x.span,
Self::TSEnumDeclaration(x) => x.span,
Self::TSInterfaceDeclaration(x) => x.span, Self::TSInterfaceDeclaration(x) => x.span,
// `Expression` // `Expression`
Self::BooleanLiteral(e) => e.span, Self::BooleanLiteral(e) => e.span,

View file

@ -991,7 +991,6 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for ExportDefaultDeclarationKind<'a> {
p.print_soft_newline(); p.print_soft_newline();
} }
Self::TSInterfaceDeclaration(interface) => interface.gen(p, ctx), Self::TSInterfaceDeclaration(interface) => interface.gen(p, ctx),
Self::TSEnumDeclaration(enum_decl) => enum_decl.gen(p, ctx),
} }
} }
} }

View file

@ -1233,7 +1233,6 @@ impl<'a> Format<'a> for ExportDefaultDeclarationKind<'a> {
Self::FunctionDeclaration(decl) => decl.format(p), Self::FunctionDeclaration(decl) => decl.format(p),
Self::ClassDeclaration(decl) => decl.format(p), Self::ClassDeclaration(decl) => decl.format(p),
Self::TSInterfaceDeclaration(decl) => decl.format(p), Self::TSInterfaceDeclaration(decl) => decl.format(p),
Self::TSEnumDeclaration(decl) => decl.format(p),
} }
} }
} }

View file

@ -60,8 +60,7 @@ fn print_semicolon_after_export_declaration<'a>(
match_expression!(ExportDefaultDeclarationKind) => Some(ss!(";")), match_expression!(ExportDefaultDeclarationKind) => Some(ss!(";")),
ExportDefaultDeclarationKind::FunctionDeclaration(_) ExportDefaultDeclarationKind::FunctionDeclaration(_)
| ExportDefaultDeclarationKind::ClassDeclaration(_) | ExportDefaultDeclarationKind::ClassDeclaration(_)
| ExportDefaultDeclarationKind::TSInterfaceDeclaration(_) | ExportDefaultDeclarationKind::TSInterfaceDeclaration(_) => None,
| ExportDefaultDeclarationKind::TSEnumDeclaration(_) => None,
}, },
ModuleDeclaration::ExportAllDeclaration(_) ModuleDeclaration::ExportAllDeclaration(_)
| ModuleDeclaration::ExportNamedDeclaration(_) | ModuleDeclaration::ExportNamedDeclaration(_)

View file

@ -249,8 +249,7 @@ impl ModuleRecordBuilder {
match_expression!(ExportDefaultDeclarationKind) => None, match_expression!(ExportDefaultDeclarationKind) => None,
ExportDefaultDeclarationKind::FunctionDeclaration(func) => func.id.as_ref(), ExportDefaultDeclarationKind::FunctionDeclaration(func) => func.id.as_ref(),
ExportDefaultDeclarationKind::ClassDeclaration(class) => class.id.as_ref(), ExportDefaultDeclarationKind::ClassDeclaration(class) => class.id.as_ref(),
ExportDefaultDeclarationKind::TSInterfaceDeclaration(_) ExportDefaultDeclarationKind::TSInterfaceDeclaration(_) => return,
| ExportDefaultDeclarationKind::TSEnumDeclaration(_) => return,
}; };
let export_entry = ExportEntry { let export_entry = ExportEntry {
export_name: ExportExportName::Default(exported_name.span()), export_name: ExportExportName::Default(exported_name.span()),

View file

@ -3054,9 +3054,6 @@ pub(crate) unsafe fn walk_export_default_declaration_kind<'a, Tr: Traverse<'a>>(
ExportDefaultDeclarationKind::TSInterfaceDeclaration(node) => { ExportDefaultDeclarationKind::TSInterfaceDeclaration(node) => {
walk_ts_interface_declaration(traverser, (&mut **node) as *mut _, ctx) walk_ts_interface_declaration(traverser, (&mut **node) as *mut _, ctx)
} }
ExportDefaultDeclarationKind::TSEnumDeclaration(node) => {
walk_ts_enum_declaration(traverser, (&mut **node) as *mut _, ctx)
}
ExportDefaultDeclarationKind::BooleanLiteral(_) ExportDefaultDeclarationKind::BooleanLiteral(_)
| ExportDefaultDeclarationKind::NullLiteral(_) | ExportDefaultDeclarationKind::NullLiteral(_)
| ExportDefaultDeclarationKind::NumericLiteral(_) | ExportDefaultDeclarationKind::NumericLiteral(_)