From 7488950f90bba8c454a12a611d1f8d77405feac7 Mon Sep 17 00:00:00 2001 From: Vladimir Guguiev Date: Sun, 27 Jun 2021 04:02:45 +0200 Subject: [PATCH] fix(es/parser): Fix span of ExportDefaultDeclaration (#1818) --- ecmascript/parser/Cargo.toml | 2 +- ecmascript/parser/src/parser/class_and_fn.rs | 25 +++++---- .../parser/src/parser/stmt/module_item.rs | 4 +- ecmascript/parser/src/parser/tests.rs | 52 +++++++++++++++++++ .../function/export-default/input.ts.json | 2 +- .../anonymousDefaultExportsAmd/input.ts.json | 2 +- .../input.ts.json | 2 +- .../input.ts.json | 2 +- .../input.ts.json | 2 +- .../input.ts.json | 2 +- .../input.ts.json | 2 +- .../input.ts.json | 2 +- .../input.ts.json | 2 +- .../anonymousDefaultExportsUmd/input.ts.json | 2 +- .../input.ts.json | 2 +- .../input.ts.json | 6 +-- .../defaultExportsCannotMerge01/input.ts.json | 2 +- .../defaultExportsCannotMerge04/input.ts.json | 2 +- .../exportAndImport-es3-amd/input.ts.json | 4 +- .../modules/exportAndImport-es3/input.ts.json | 4 +- .../exportAndImport-es5-amd/input.ts.json | 4 +- .../modules/exportAndImport-es5/input.ts.json | 4 +- .../multipleDefaultExports01/input.ts.json | 2 +- .../multipleDefaultExports02/input.ts.json | 4 +- .../multipleDefaultExports04/input.ts.json | 4 +- .../reExportDefaultExport/input.ts.json | 2 +- .../es6modulekindWithES5Target6/input.ts.json | 2 +- .../input.ts.json | 2 +- .../multipleExportDefault1/input.ts.json | 2 +- .../multipleExportDefault2/input.ts.json | 2 +- .../multipleExportDefault5/input.ts.json | 2 +- .../jsDeclarationsDefault/input.ts.json | 4 +- .../input.tsx.json | 2 +- .../input.tsx.json | 2 +- .../input.tsx.json | 2 +- .../input.tsx.json | 2 +- .../typeFromPropertyAssignment5/input.ts.json | 2 +- 37 files changed, 113 insertions(+), 54 deletions(-) diff --git a/ecmascript/parser/Cargo.toml b/ecmascript/parser/Cargo.toml index 08fa7c5afb3..a4e821ee01c 100644 --- a/ecmascript/parser/Cargo.toml +++ b/ecmascript/parser/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"] license = "Apache-2.0/MIT" name = "swc_ecma_parser" repository = "https://github.com/swc-project/swc.git" -version = "0.61.0" +version = "0.61.1" [features] default = [] diff --git a/ecmascript/parser/src/parser/class_and_fn.rs b/ecmascript/parser/src/parser/class_and_fn.rs index d30c0c3117e..ffd0f32cdc8 100644 --- a/ecmascript/parser/src/parser/class_and_fn.rs +++ b/ecmascript/parser/src/parser/class_and_fn.rs @@ -10,38 +10,40 @@ impl<'a, I: Tokens> Parser { pub(super) fn parse_async_fn_expr(&mut self) -> PResult> { let start = cur_pos!(self); expect!(self, "async"); - self.parse_fn(Some(start), vec![]) + self.parse_fn(None, Some(start), vec![]) } /// Parse function expression pub(super) fn parse_fn_expr(&mut self) -> PResult> { - self.parse_fn(None, vec![]) + self.parse_fn(None, None, vec![]) } pub(super) fn parse_async_fn_decl(&mut self, decorators: Vec) -> PResult { let start = cur_pos!(self); expect!(self, "async"); - self.parse_fn(Some(start), decorators) + self.parse_fn(None, Some(start), decorators) } pub(super) fn parse_fn_decl(&mut self, decorators: Vec) -> PResult { - self.parse_fn(None, decorators) + self.parse_fn(None, None, decorators) } pub(super) fn parse_default_async_fn( &mut self, + start: BytePos, decorators: Vec, ) -> PResult { - let start = cur_pos!(self); + let start_of_async = cur_pos!(self); expect!(self, "async"); - self.parse_fn(Some(start), decorators) + self.parse_fn(Some(start), Some(start_of_async), decorators) } pub(super) fn parse_default_fn( &mut self, + start: BytePos, decorators: Vec, ) -> PResult { - self.parse_fn(None, decorators) + self.parse_fn(Some(start), None, decorators) } pub(super) fn parse_class_decl( @@ -951,6 +953,7 @@ impl<'a, I: Tokens> Parser { fn parse_fn( &mut self, + start_of_output_type: Option, start_of_async: Option, decorators: Vec, ) -> PResult @@ -1016,7 +1019,11 @@ impl<'a, I: Tokens> Parser { // let body = p.parse_fn_body(is_async, is_generator)?; - Ok(T::finish_fn(span!(p, start), ident, f)) + Ok(T::finish_fn( + span!(p, start_of_output_type.unwrap_or(start)), + ident, + f, + )) }) } @@ -1327,7 +1334,7 @@ impl OutputType for Decl { i.sym == js_word!("constructor") } - fn finish_fn(span: Span, ident: Ident, function: Function) -> Self { + fn finish_fn(_span: Span, ident: Ident, function: Function) -> Self { Decl::Fn(FnDecl { declare: false, ident, diff --git a/ecmascript/parser/src/parser/stmt/module_item.rs b/ecmascript/parser/src/parser/stmt/module_item.rs index a26f17f05da..b551541184d 100644 --- a/ecmascript/parser/src/parser/stmt/module_item.rs +++ b/ecmascript/parser/src/parser/stmt/module_item.rs @@ -384,10 +384,10 @@ impl<'a, I: Tokens> Parser { && peeked_is!(self, "function") && !self.input.has_linebreak_between_cur_and_peeked() { - let decl = self.parse_default_async_fn(decorators)?; + let decl = self.parse_default_async_fn(start, decorators)?; return Ok(ModuleDecl::ExportDefaultDecl(decl)); } else if is!(self, "function") { - let decl = self.parse_default_fn(decorators)?; + let decl = self.parse_default_fn(start, decorators)?; return Ok(ModuleDecl::ExportDefaultDecl(decl)); } else if self.input.syntax().export_default_from() && (is!(self, "from") || (is!(self, ',') && peeked_is!(self, '{'))) diff --git a/ecmascript/parser/src/parser/tests.rs b/ecmascript/parser/src/parser/tests.rs index dcbb95ab023..36acbae3032 100644 --- a/ecmascript/parser/src/parser/tests.rs +++ b/ecmascript/parser/src/parser/tests.rs @@ -1,4 +1,5 @@ use crate::test_parser; +use swc_common::BytePos; use swc_ecma_ast::*; fn program(src: &'static str) -> Program { @@ -81,3 +82,54 @@ fn issue_1813() { }, ) } + +fn parse_module_export_named_span() { + let m = module("export function foo() {}"); + if let ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl { span, .. })) = &m.body[0] { + assert_eq!(span.lo, BytePos(0)); + } else { + panic!("expected ExportDecl"); + } +} + +#[test] +fn parse_module_export_default_fn_span() { + let m = module("export default function foo() {}"); + if let ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultDecl(ExportDefaultDecl { + span, .. + })) = &m.body[0] + { + assert_eq!(span.lo, BytePos(0)); + assert_eq!(span.hi, BytePos(32)); + } else { + panic!("expected ExportDefaultDecl"); + } +} + +#[test] +fn parse_module_export_default_async_fn_span() { + let m = module("export default async function foo() {}"); + if let ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultDecl(ExportDefaultDecl { + span, .. + })) = &m.body[0] + { + assert_eq!(span.lo, BytePos(0)); + assert_eq!(span.hi, BytePos(38)); + } else { + panic!("expected ExportDefaultDecl"); + } +} + +#[test] +fn parse_module_export_default_class_span() { + let m = module("export default class Foo {}"); + if let ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultDecl(ExportDefaultDecl { + span, .. + })) = &m.body[0] + { + assert_eq!(span.lo, BytePos(0)); + assert_eq!(span.hi, BytePos(27)); + } else { + panic!("expected ExportDefaultDecl"); + } +} diff --git a/ecmascript/parser/tests/typescript/function/export-default/input.ts.json b/ecmascript/parser/tests/typescript/function/export-default/input.ts.json index 54024bf6918..632b9c25942 100644 --- a/ecmascript/parser/tests/typescript/function/export-default/input.ts.json +++ b/ecmascript/parser/tests/typescript/function/export-default/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 15, + "start": 0, "end": 42, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/anonymousDefaultExportsAmd/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/anonymousDefaultExportsAmd/input.ts.json index 42c144ecc66..ac86c9c9832 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/anonymousDefaultExportsAmd/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/anonymousDefaultExportsAmd/input.ts.json @@ -33,7 +33,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 110, + "start": 95, "end": 123, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/defaultExportsGetExportedAmd/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/defaultExportsGetExportedAmd/input.ts.json index 343dd1eafe0..e49bb869c91 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/defaultExportsGetExportedAmd/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/defaultExportsGetExportedAmd/input.ts.json @@ -42,7 +42,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 114, + "start": 99, "end": 131, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd/input.ts.json index 73615de7f8f..20654b827f3 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd/input.ts.json @@ -158,7 +158,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 260, + "start": 245, "end": 289, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsCommonjs/anonymousDefaultExportsCommonjs/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsCommonjs/anonymousDefaultExportsCommonjs/input.ts.json index ad68ba6a391..70b8ef1c728 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsCommonjs/anonymousDefaultExportsCommonjs/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsCommonjs/anonymousDefaultExportsCommonjs/input.ts.json @@ -33,7 +33,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 115, + "start": 100, "end": 128, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs/input.ts.json index 708e1326d0d..16d815be64d 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs/input.ts.json @@ -42,7 +42,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 119, + "start": 104, "end": 136, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/anonymousDefaultExportsSystem/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/anonymousDefaultExportsSystem/input.ts.json index 80208f163c4..e09077f6f97 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/anonymousDefaultExportsSystem/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/anonymousDefaultExportsSystem/input.ts.json @@ -33,7 +33,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 113, + "start": 98, "end": 126, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/defaultExportsGetExportedSystem/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/defaultExportsGetExportedSystem/input.ts.json index 4e9ff28cbda..61412852a56 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/defaultExportsGetExportedSystem/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/defaultExportsGetExportedSystem/input.ts.json @@ -42,7 +42,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 117, + "start": 102, "end": 134, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem/input.ts.json index 39ee52a9294..6908aef59de 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem/input.ts.json @@ -158,7 +158,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 266, + "start": 251, "end": 295, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsUmd/anonymousDefaultExportsUmd/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsUmd/anonymousDefaultExportsUmd/input.ts.json index 42c144ecc66..ac86c9c9832 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsUmd/anonymousDefaultExportsUmd/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsUmd/anonymousDefaultExportsUmd/input.ts.json @@ -33,7 +33,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 110, + "start": 95, "end": 123, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsUmd/defaultExportsGetExportedUmd/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsUmd/defaultExportsGetExportedUmd/input.ts.json index 343dd1eafe0..e49bb869c91 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsUmd/defaultExportsGetExportedUmd/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/moduleExportsUmd/defaultExportsGetExportedUmd/input.ts.json @@ -42,7 +42,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 114, + "start": 99, "end": 131, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportWithOverloads01/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportWithOverloads01/input.ts.json index d1a69aa769d..36f62d7bae0 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportWithOverloads01/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportWithOverloads01/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 53, + "start": 38, "end": 66, "ctxt": 0 }, @@ -42,7 +42,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 82, + "start": 67, "end": 104, "ctxt": 0 }, @@ -112,7 +112,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 120, + "start": 105, "end": 150, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportsCannotMerge01/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportsCannotMerge01/input.ts.json index 3430af7962b..cd79326a930 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportsCannotMerge01/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportsCannotMerge01/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 73, + "start": 58, "end": 106, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportsCannotMerge04/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportsCannotMerge04/input.ts.json index 1bd0957ab15..fe1d3a22e5c 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportsCannotMerge04/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/defaultExportsCannotMerge04/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 53, + "start": 38, "end": 71, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es3-amd/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es3-amd/input.ts.json index 55ccbd00a47..3377dc55fc2 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es3-amd/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es3-amd/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 66, + "start": 51, "end": 83, "ctxt": 0 }, @@ -94,7 +94,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 143, + "start": 128, "end": 170, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es3/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es3/input.ts.json index 907a5cf7f43..2f1173522ed 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es3/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es3/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 71, + "start": 56, "end": 88, "ctxt": 0 }, @@ -94,7 +94,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 148, + "start": 133, "end": 173, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es5-amd/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es5-amd/input.ts.json index 55ccbd00a47..3377dc55fc2 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es5-amd/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es5-amd/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 66, + "start": 51, "end": 83, "ctxt": 0 }, @@ -94,7 +94,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 143, + "start": 128, "end": 170, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es5/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es5/input.ts.json index 1fb772b4803..8a54e63a3de 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es5/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/exportAndImport-es5/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 71, + "start": 56, "end": 88, "ctxt": 0 }, @@ -94,7 +94,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 148, + "start": 133, "end": 175, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports01/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports01/input.ts.json index b952b23cf18..9b5c928e7b4 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports01/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports01/input.ts.json @@ -42,7 +42,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 104, + "start": 89, "end": 123, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports02/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports02/input.ts.json index 8d00fe2f882..c450a5c8f15 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports02/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports02/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 73, + "start": 58, "end": 92, "ctxt": 0 }, @@ -50,7 +50,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 109, + "start": 94, "end": 128, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports04/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports04/input.ts.json index 0623bb63477..d94dcf24b89 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports04/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/multipleDefaultExports04/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 53, + "start": 38, "end": 69, "ctxt": 0 }, @@ -50,7 +50,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 86, + "start": 71, "end": 102, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/es6/modules/reExportDefaultExport/input.ts.json b/ecmascript/parser/tests/typescript/tsc/es6/modules/reExportDefaultExport/input.ts.json index 1c2a28f361b..998b3ac27e3 100644 --- a/ecmascript/parser/tests/typescript/tsc/es6/modules/reExportDefaultExport/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/es6/modules/reExportDefaultExport/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 73, + "start": 58, "end": 89, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/externalModules/es6/es6modulekindWithES5Target6/input.ts.json b/ecmascript/parser/tests/typescript/tsc/externalModules/es6/es6modulekindWithES5Target6/input.ts.json index 605bb4b4d99..04fbe4e9332 100644 --- a/ecmascript/parser/tests/typescript/tsc/externalModules/es6/es6modulekindWithES5Target6/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/externalModules/es6/es6modulekindWithES5Target6/input.ts.json @@ -167,7 +167,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 114, + "start": 99, "end": 136, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/externalModules/esnext/esnextmodulekindWithES5Target6/input.ts.json b/ecmascript/parser/tests/typescript/tsc/externalModules/esnext/esnextmodulekindWithES5Target6/input.ts.json index 605bb4b4d99..04fbe4e9332 100644 --- a/ecmascript/parser/tests/typescript/tsc/externalModules/esnext/esnextmodulekindWithES5Target6/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/externalModules/esnext/esnextmodulekindWithES5Target6/input.ts.json @@ -167,7 +167,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 114, + "start": 99, "end": 136, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault1/input.ts.json b/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault1/input.ts.json index 2efcd845e23..077df70f696 100644 --- a/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault1/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault1/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 15, + "start": 0, "end": 38, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault2/input.ts.json b/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault2/input.ts.json index 8b6508bc17c..ff103badc9a 100644 --- a/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault2/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault2/input.ts.json @@ -54,7 +54,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 65, + "start": 50, "end": 83, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault5/input.ts.json b/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault5/input.ts.json index e231fc443ce..ce95550edb0 100644 --- a/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault5/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/externalModules/multipleExportDefault5/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 15, + "start": 0, "end": 33, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/jsdoc/declarations/jsDeclarationsDefault/input.ts.json b/ecmascript/parser/tests/typescript/tsc/jsdoc/declarations/jsDeclarationsDefault/input.ts.json index 5c063460bed..92d680baabb 100644 --- a/ecmascript/parser/tests/typescript/tsc/jsdoc/declarations/jsDeclarationsDefault/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/jsdoc/declarations/jsDeclarationsDefault/input.ts.json @@ -26,7 +26,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 175, + "start": 160, "end": 209, "ctxt": 0 }, @@ -515,7 +515,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 725, + "start": 710, "end": 743, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution13x/input.tsx.json b/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution13x/input.tsx.json index 729743e5d44..01220df643b 100644 --- a/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution13x/input.tsx.json +++ b/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution13x/input.tsx.json @@ -165,7 +165,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 240, + "start": 225, "end": 499, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution14x/input.tsx.json b/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution14x/input.tsx.json index cc4f53a279f..d976075f4e9 100644 --- a/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution14x/input.tsx.json +++ b/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution14x/input.tsx.json @@ -165,7 +165,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 240, + "start": 225, "end": 386, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution15x/input.tsx.json b/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution15x/input.tsx.json index 6817f52aef5..02b1d5a9866 100644 --- a/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution15x/input.tsx.json +++ b/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution15x/input.tsx.json @@ -165,7 +165,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 240, + "start": 225, "end": 376, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution16x/input.tsx.json b/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution16x/input.tsx.json index c9c5eda8173..ce3a9acd671 100644 --- a/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution16x/input.tsx.json +++ b/ecmascript/parser/tests/typescript/tsc/jsx/tsxSpreadAttributesResolution16x/input.tsx.json @@ -165,7 +165,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 240, + "start": 225, "end": 380, "ctxt": 0 }, diff --git a/ecmascript/parser/tests/typescript/tsc/salsa/typeFromPropertyAssignment5/input.ts.json b/ecmascript/parser/tests/typescript/tsc/salsa/typeFromPropertyAssignment5/input.ts.json index 0d078b14b08..d72cb095cec 100644 --- a/ecmascript/parser/tests/typescript/tsc/salsa/typeFromPropertyAssignment5/input.ts.json +++ b/ecmascript/parser/tests/typescript/tsc/salsa/typeFromPropertyAssignment5/input.ts.json @@ -9,7 +9,7 @@ { "type": "ExportDefaultDeclaration", "span": { - "start": 103, + "start": 88, "end": 125, "ctxt": 0 },