Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1539,8 +1539,17 @@ impl<'a> SemanticBuilder<'a> {
/* cfg */

match kind {
AstKind::ExportDefaultDeclaration(_) => {
self.current_symbol_flags |= SymbolFlags::Export;
AstKind::ExportDefaultDeclaration(decl) => {
// Only if the declaration has an id, we mark it as an export
if match &decl.declaration {
ExportDefaultDeclarationKind::FunctionDeclaration(ref func) => {
func.id.is_some()
}
ExportDefaultDeclarationKind::ClassDeclaration(ref class) => class.id.is_some(),
_ => true,
} {
self.current_symbol_flags |= SymbolFlags::Export;
}
}
AstKind::ExportNamedDeclaration(decl) => {
self.current_symbol_flags |= SymbolFlags::Export;
Expand Down Expand Up @@ -1588,7 +1597,6 @@ impl<'a> SemanticBuilder<'a> {
if class.is_declaration() {
class.bind(self);
}
self.current_symbol_flags -= SymbolFlags::Export;
self.make_all_namespaces_valuelike();
}
AstKind::ClassBody(body) => {
Expand All @@ -1608,9 +1616,6 @@ impl<'a> SemanticBuilder<'a> {
AstKind::BindingRestElement(element) => {
element.bind(self);
}
AstKind::FormalParameters(_) => {
self.current_symbol_flags -= SymbolFlags::Export;
}
AstKind::FormalParameter(param) => {
param.bind(self);
}
Expand Down Expand Up @@ -1699,11 +1704,10 @@ impl<'a> SemanticBuilder<'a> {
self.current_node_flags -= NodeFlags::Class;
self.class_table_builder.pop_class();
}
AstKind::ExportDefaultDeclaration(_) => {
AstKind::BindingIdentifier(_) => {
self.current_symbol_flags -= SymbolFlags::Export;
}
AstKind::ExportNamedDeclaration(decl) => {
self.current_symbol_flags -= SymbolFlags::Export;
if decl.export_kind.is_type() {
self.current_reference_flag -= ReferenceFlag::Type;
}
Expand Down