fix(es/compat): Handle export default decorator only if not empty (#8099)

**Related issue:**

 - Closes: #8098
This commit is contained in:
magic-akari 2023-10-11 07:24:22 -05:00 committed by GitHub
parent 3dc761ab47
commit bf523f5351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1 deletions

View File

@ -1449,7 +1449,7 @@ impl VisitMut for Decorator202203 {
ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultDecl(ExportDefaultDecl { ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultDecl(ExportDefaultDecl {
span: _, span: _,
decl: DefaultDecl::Class(c), decl: DefaultDecl::Class(c),
})) => { })) if !c.class.decorators.is_empty() => {
self.handle_class_expr(&mut c.class, c.ident.as_ref()); self.handle_class_expr(&mut c.class, c.ident.as_ref());
s.visit_mut_children_with(self); s.visit_mut_children_with(self);
} }

View File

@ -0,0 +1 @@
export default class T {}

View File

@ -0,0 +1,2 @@
export default class T {
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["proposal-decorators", { "version": "2022-03" }]]
}