Skip to content

Commit

Permalink
fix(semantic): incorrect ExportEntry span for ExportAllDeclaration in…
Browse files Browse the repository at this point in the history
… ModuleRecord (oxc-project#2793)

Now the span is ExportAllDeclaration's span
  • Loading branch information
Dunqing authored and charnog committed Mar 26, 2024
1 parent a454695 commit 451b2e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/oxc_semantic/src/module_record/builder.rs
Expand Up @@ -219,6 +219,7 @@ impl ModuleRecordBuilder {
exported_name.span(),
))
}),
span: decl.span,
..ExportEntry::default()
};
self.add_export_entry(export_entry);
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_semantic/src/module_record/mod.rs
Expand Up @@ -97,6 +97,7 @@ mod module_record_tests {
let export_entry = ExportEntry {
module_request: Some(NameSpan::new("mod".into(), Span::new(14, 19))),
import_name: ExportImportName::AllButDefault,
span: Span::new(0, 19),
..ExportEntry::default()
};
assert_eq!(module_record.star_export_entries.len(), 1);
Expand All @@ -112,6 +113,7 @@ mod module_record_tests {
module_request: Some(NameSpan::new("mod".into(), Span::new(20, 25))),
import_name: ExportImportName::All,
export_name: ExportExportName::Name(NameSpan::new("ns".into(), Span::new(12, 14))),
span: Span::new(0, 25),
..ExportEntry::default()
};
assert_eq!(module_record.indirect_export_entries.len(), 1);
Expand Down Expand Up @@ -268,7 +270,7 @@ mod module_record_tests {
module_record.indirect_export_entries[1],
ExportEntry {
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,
export_name: ExportExportName::Name(NameSpan::new("ns".into(), Span::new(49, 51))),
local_name: ExportLocalName::Null,
Expand Down

0 comments on commit 451b2e9

Please sign in to comment.