mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(semantic): add export binding for ExportDefaultDeclarations in module record (#2329)
This commit is contained in:
parent
3b7dfb9bd1
commit
40e9541cec
3 changed files with 14 additions and 2 deletions
|
|
@ -247,7 +247,9 @@ fn test() {
|
|||
let fail = vec![
|
||||
(r#"let foo; export { foo }; export * from "./export-all""#),
|
||||
// (r#"export * from "./malformed.js""#),
|
||||
(r#"export * from "./default-export""#),
|
||||
// This case has been comment out in eslint-plugin-import
|
||||
// https://github.com/import-js/eslint-plugin-import/blob/7a21f7e10f18c04473faadca94928af6b8e28009/tests/src/rules/export.js#L101-L109
|
||||
// (r#"export * from "./default-export""#),
|
||||
(r#"let foo; export { foo as "foo" }; export * from "./export-all""#),
|
||||
("
|
||||
export type Foo = string;
|
||||
|
|
|
|||
|
|
@ -291,6 +291,9 @@ impl ModuleRecordBuilder {
|
|||
..ExportEntry::default()
|
||||
};
|
||||
self.add_export_entry(export_entry);
|
||||
if let Some(id) = id {
|
||||
self.add_export_binding(id.name.clone(), id.span);
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_export_named_declaration(&mut self, decl: &ExportNamedDeclaration) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,14 @@ pub use util::SemanticTester;
|
|||
|
||||
#[test]
|
||||
fn test_class_simple() {
|
||||
SemanticTester::js("export class Foo {}")
|
||||
SemanticTester::js("export class Foo {};")
|
||||
.has_root_symbol("Foo")
|
||||
.contains_flags(SymbolFlags::Class | SymbolFlags::Export)
|
||||
.has_number_of_references(0)
|
||||
.is_exported()
|
||||
.test();
|
||||
|
||||
SemanticTester::js("export default class Foo {};")
|
||||
.has_root_symbol("Foo")
|
||||
.contains_flags(SymbolFlags::Class | SymbolFlags::Export)
|
||||
.has_number_of_references(0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue