mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
fix(semantic): incorrect ExportEntry span for ExportAllDeclaration in ModuleRecord (#2793)
Now the span is ExportAllDeclaration's span
This commit is contained in:
parent
525031b7a2
commit
b28b61774b
2 changed files with 4 additions and 1 deletions
|
|
@ -219,6 +219,7 @@ impl ModuleRecordBuilder {
|
||||||
exported_name.span(),
|
exported_name.span(),
|
||||||
))
|
))
|
||||||
}),
|
}),
|
||||||
|
span: decl.span,
|
||||||
..ExportEntry::default()
|
..ExportEntry::default()
|
||||||
};
|
};
|
||||||
self.add_export_entry(export_entry);
|
self.add_export_entry(export_entry);
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ mod module_record_tests {
|
||||||
let export_entry = ExportEntry {
|
let export_entry = ExportEntry {
|
||||||
module_request: Some(NameSpan::new("mod".into(), Span::new(14, 19))),
|
module_request: Some(NameSpan::new("mod".into(), Span::new(14, 19))),
|
||||||
import_name: ExportImportName::AllButDefault,
|
import_name: ExportImportName::AllButDefault,
|
||||||
|
span: Span::new(0, 19),
|
||||||
..ExportEntry::default()
|
..ExportEntry::default()
|
||||||
};
|
};
|
||||||
assert_eq!(module_record.star_export_entries.len(), 1);
|
assert_eq!(module_record.star_export_entries.len(), 1);
|
||||||
|
|
@ -112,6 +113,7 @@ mod module_record_tests {
|
||||||
module_request: Some(NameSpan::new("mod".into(), Span::new(20, 25))),
|
module_request: Some(NameSpan::new("mod".into(), Span::new(20, 25))),
|
||||||
import_name: ExportImportName::All,
|
import_name: ExportImportName::All,
|
||||||
export_name: ExportExportName::Name(NameSpan::new("ns".into(), Span::new(12, 14))),
|
export_name: ExportExportName::Name(NameSpan::new("ns".into(), Span::new(12, 14))),
|
||||||
|
span: Span::new(0, 25),
|
||||||
..ExportEntry::default()
|
..ExportEntry::default()
|
||||||
};
|
};
|
||||||
assert_eq!(module_record.indirect_export_entries.len(), 1);
|
assert_eq!(module_record.indirect_export_entries.len(), 1);
|
||||||
|
|
@ -268,7 +270,7 @@ mod module_record_tests {
|
||||||
module_record.indirect_export_entries[1],
|
module_record.indirect_export_entries[1],
|
||||||
ExportEntry {
|
ExportEntry {
|
||||||
module_request: Some(NameSpan::new("mod".into(), Span::new(57, 62))),
|
module_request: Some(NameSpan::new("mod".into(), Span::new(57, 62))),
|
||||||
span: Span::new(0, 0),
|
span: Span::new(37, 63),
|
||||||
import_name: ExportImportName::All,
|
import_name: ExportImportName::All,
|
||||||
export_name: ExportExportName::Name(NameSpan::new("ns".into(), Span::new(49, 51))),
|
export_name: ExportExportName::Name(NameSpan::new("ns".into(), Span::new(49, 51))),
|
||||||
local_name: ExportLocalName::Null,
|
local_name: ExportLocalName::Null,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue