From 2b32fc6fee36c0a6f5bb6cccf6eeb237d9691af7 Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 17 Dec 2024 20:19:31 +0800 Subject: [PATCH] fix(parser): include `export` in the span of TSNamespaceExportDeclaration --- crates/oxc_parser/src/js/module.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oxc_parser/src/js/module.rs b/crates/oxc_parser/src/js/module.rs index 60a91b0841e2f..2ef147e0515d3 100644 --- a/crates/oxc_parser/src/js/module.rs +++ b/crates/oxc_parser/src/js/module.rs @@ -221,13 +221,13 @@ impl<'a> ParserImpl<'a> { pub(crate) fn parse_ts_export_namespace( &mut self, + start_span: Span, ) -> Result>> { - let span = self.start_span(); self.expect(Kind::As)?; self.expect(Kind::Namespace)?; let id = self.parse_identifier_name()?; self.asi()?; - Ok(self.ast.alloc_ts_namespace_export_declaration(self.end_span(span), id)) + Ok(self.ast.alloc_ts_namespace_export_declaration(self.end_span(start_span), id)) } /// [Exports](https://tc39.es/ecma262/#sec-exports) @@ -240,7 +240,7 @@ impl<'a> ParserImpl<'a> { .parse_ts_export_assignment_declaration(span) .map(ModuleDeclaration::TSExportAssignment), Kind::As if self.peek_at(Kind::Namespace) && self.is_ts => self - .parse_ts_export_namespace() + .parse_ts_export_namespace(span) .map(ModuleDeclaration::TSNamespaceExportDeclaration), Kind::Default => self .parse_export_default_declaration(span)